cassandra将数据从一个columnfamily复制到另一个columnfamily

编程入门 行业动态 更新时间:2024-10-25 22:27:09
本文介绍了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.

详情:

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

更多推荐

cassandra将数据从一个columnfamily复制到另一个columnfamily

本文发布于:2023-10-07 13:08:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469467.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   cassandra   columnfamily

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!