cassandra将数据从一个columnfamily复制到另一个columnfamily [英] cassandra copy data from one columnfamily to another columnfamily

查看:318
本文介绍了cassandra将数据从一个columnfamily复制到另一个columnfamily的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是cassandra的新手。我需要复制数据从一个columnFamily到另一个columnFamily在相同的keyspace在cassandra .Say为ex我们有一个A1 columnFamily在keyspace K1,所以现在我需要创建columnFamily A2在同一个键空间K1。我需要复制数据columnFamily A1到A2 .A1和A2具有相同的模式。我阅读在线文档,在这里我们可以使用sstable加载器将数据从一个cassandra集群复制到另一个。但在这里,我需要将数据从一个columnFamily复制到同一个键空间内的另一个columnFamily。

I am newbie to cassandra . I need to copy data from one columnFamily to another columnFamily in same keyspace in cassandra .Say for ex we have a A1 columnFamily in keyspace K1 , so now i need to create columnFamily A2 in the same keyspace K1 .Here i need to copy data from columnFamily A1 to A2 .A1 and A2 have the same schema .I read online docs where in we can use sstable loader to copy data from one cassandra cluster to another . But here i need to copy data from one columnFamily to another columnFamily within same keyspace .

上面的任何想法。

推荐答案

根据cassandra版本,您可以使用copy cql命令。

Depending on the cassandra version you can use the copy cql command. To use that you need a cql client like the one that is distributted with cassandra.

首先,您必须使用以下命令将列系列A1复制到CSV文件:

First you have to copy the columnfamily A1 to a CSV file using:

COPY K1.A1 (column1, column2,...) TO 'temp.csv';

然后将文件复制到新列族

And after that copy the file to the new column family

COPY K1.A2 (column1, column2,...) FROM 'temp.csv';

显然,您必须将列的名称更改为您的姓名。

Obviously you have to change the name of the columns to your names.

详情:

http://www.datastax.com/documentation/cassandra/1.2/index.html#cassandra/cql_reference/copy_r.html

这篇关于cassandra将数据从一个columnfamily复制到另一个columnfamily的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆