如何把一个keyspace作为转储在cassandra? [英] how to take a keyspace as a dump in cassandra?
本文介绍了如何把一个keyspace作为转储在cassandra?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从服务器作为一个转储和恢复到我的本地cassandra
我知道在mysql,但如何在nosql做一个键空间?
我从网站学到nodetool,snapshot和csv文件格式可以实现这一点,但是我无法得到它。
I need to take a keyspace from the server as a dump and restore that dump to my local cassandra, I know to do in mysql but how to do in nosql ? I learn from site that nodetool ,snapshot and csv file format can achieve this,but I unable to got it ?
推荐答案
p>你可以使用nodetool来做到这一点。有关良好的参考文档,请查看此处: http://www.datastax.com/docs/1.1/backup_restore
You can do this with "nodetool". For a good reference documentation take a look here: http://www.datastax.com/docs/1.1/backup_restore
大致您需要执行以下步骤:
Roughly you need to perform the following steps:
- 快照:
nodetool snapshot< keyspace-name>
。这是在服务器上运行,您要在其中生成一个快照。它会这样做,为键空间的每个表存储快照。 - 将快照复制到本地服务器。为每个键空间表执行此操作:
< cassandra-dir> / data /< keyspace-name> /< table-name> / snapshots /
最新拍摄的快照 - 当您拍摄快照时,它会告诉您拍摄的快照的名称/ID)。 - 在您的本地服务器中,放置服务器快照之前,请执行以下操作:stop cassandra,删除该键空间的内容(再次为每个键空间表:
< cassandra-dir> / data /< keyspace> /< table-name> /
),然后将服务器快照放在每个keysapce< cassandra-dir> / data /< keyspace> /< table-name> /
,而不是快照目录)。 - 重新启动本地服务器,您应该从本地服务器的服务器获取数据。
- take a "snapshot" of the keyspace using:
nodetool snapshot <keyspace-name>
. This is run on the server, where you want to take generates a "snapshot". It will do that, storing a "snapshot" for each table of the keyspace. - copy the "snapshots" to your local server. Do this for each keyspace table:
<cassandra-dir>/data/<keyspace-name>/<table-name>/snapshots/
(look for the "latest" taken snapshot - when you take the snapshot it tells you the "name"/"ID" of the snapshot taken). - in your local server, before you place the "server" snapshots do the following: stop cassandra, delete the content of that "keyspace"(again for each keyspace table:
<cassandra-dir>/data/<keyspace>/<table-name>/
) and then place the "server" snapshots in each respective "keysapce table" (directly in the<cassandra-dir>/data/<keyspace>/<table-name>/
and not in the "snapshot" directory). - restart the local server, and you should have the data from the server in your local server.
HTH。
这篇关于如何把一个keyspace作为转储在cassandra?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文