中的密钥空间模式导入和导出

中的密钥空间模式导入和导出

本文介绍了Cassandra 中的密钥空间模式导入和导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的系统上安装了 Cassandra 1.1.2 作为单节点集群,并且有三个键空间:hotelstudentemployee.如果可能,我想转储 hotel 的键空间架构及其列族数据,并在其他 Cassandra 集群上恢复转储.任何人都可以详细建议我该怎么做?

I have a Cassandra 1.1.2 installation on my system as a single node cluster and have three keyspaces: hotel, student and employee. I want to dump the keyspace schema of hotel along with its column family data if possible and restore the dump on other Cassandra cluster. Can any one suggest me in detail that how should I do this?

推荐答案

您可以使用 sstable2jsonjson2sstable cassandra 工具

You can use sstable2json and json2sstable cassandra tools

查看 Datastax 文档这个也是

Check out Datastax documentation on the same and this too

Usage: sstable2json [-f outfile] <sstable> [-k key [-k key [...]]]
Usage: json2sstable -K keyspace -c column_family <json> <sstable>

你总是可以在文件中执行 cassandra-cli 命令

You can always execute cassandra-cli commands in file

cassandra-cli -h HOST -p PORT -f fileName

您可以将所有创建语句加载到文件中并执行此命令

You can load all your create statements in to a file and execute this command

要获取 cli 脚本以创建键空间和列族,请在 cassandra-cli 界面中使用以下命令

To get cli scripts to create keyspaces and column families use following command in cassandra-cli interface

show schema

但如果您想创建一个包含两个节点的集群.您无需执行上述所有操作.只需启动具有不同令牌范围和相同集群名称的另一个节点即可.Cassandra 将在内部设法传输数据和模式信息

But incase you wanna create a cluster of two nodes. You don't need to do all the above. Just starting the other node with different token range and same cluster name would do. Cassandra internally will manage to stream the data and schema informations

这篇关于Cassandra 中的密钥空间模式导入和导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 02:18