We have 2 cassandra clusters, first one has the old data and second one has the new data.
我们有2个cassandra集群,第一个拥有旧数据,第二个拥有新数据。
Now we want to move or copy the old data from first cluster to second. What is the best way to do this and how to do this?
现在我们要将旧数据从第一个集群移动或复制到第二个集群。最好的方法是什么以及如何做到这一点?
we are using DSE 3.1.4.
我们正在使用DSE 3.1.4。
2 个解决方案
#1
3
One tool you could try would be the COPY TO/FROM cqlsh command.
您可以尝试的一个工具是COPY TO / FROM cqlsh命令。
On a node in the old cluster, you would use the COPY FROM:
在旧群集中的节点上,您将使用COPY FROM:
cqlsh> COPY myTable (col1, col2, col3, col4) TO 'temp.csv'
And then (after copying the file over) on a node in your new cluster, you would copy the data in the CSV file into Cassandra:
然后(在复制文件之后)在新群集中的节点上,您将CSV文件中的数据复制到Cassandra中:
cqlsh> COPY myTable (col1, col2, col3, col4) FROM 'temp.csv'
Here is some more documentation on the COPY command.
以下是有关COPY命令的更多文档。
Note that the COPY TO/FROM is recommended for tables that contain only a few million rows or less. For larger datasets you should look at:
请注意,对于仅包含几百万行或更少行的表,建议使用COPY TO / FROM。对于较大的数据集,您应该查看:
- Cassandra Bulk Loader
- 卡桑德拉散装装载机
- sstable2json
- sstable2json
#2
2
There is a tool called /usr/bin/sstableloader for copying data between the clusters. Although when I used it months ago, I encountered an error and used this instead. But since it was a long time ago, sstableloader might have been fixed already.
有一个名为/ usr / bin / sstableloader的工具用于在集群之间复制数据。虽然几个月前我使用它时,我遇到了一个错误并使用了它。但是既然很久以前,sstableloader可能已经修好了。
#1
3
One tool you could try would be the COPY TO/FROM cqlsh command.
您可以尝试的一个工具是COPY TO / FROM cqlsh命令。
On a node in the old cluster, you would use the COPY FROM:
在旧群集中的节点上,您将使用COPY FROM:
cqlsh> COPY myTable (col1, col2, col3, col4) TO 'temp.csv'
And then (after copying the file over) on a node in your new cluster, you would copy the data in the CSV file into Cassandra:
然后(在复制文件之后)在新群集中的节点上,您将CSV文件中的数据复制到Cassandra中:
cqlsh> COPY myTable (col1, col2, col3, col4) FROM 'temp.csv'
Here is some more documentation on the COPY command.
以下是有关COPY命令的更多文档。
Note that the COPY TO/FROM is recommended for tables that contain only a few million rows or less. For larger datasets you should look at:
请注意,对于仅包含几百万行或更少行的表,建议使用COPY TO / FROM。对于较大的数据集,您应该查看:
- Cassandra Bulk Loader
- 卡桑德拉散装装载机
- sstable2json
- sstable2json
#2
2
There is a tool called /usr/bin/sstableloader for copying data between the clusters. Although when I used it months ago, I encountered an error and used this instead. But since it was a long time ago, sstableloader might have been fixed already.
有一个名为/ usr / bin / sstableloader的工具用于在集群之间复制数据。虽然几个月前我使用它时,我遇到了一个错误并使用了它。但是既然很久以前,sstableloader可能已经修好了。