Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to take a keyspace as a dump in cassandra?

Tags:

cassandra

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 ?

like image 390
kumar Avatar asked Nov 27 '13 05:11

kumar


1 Answers

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:

  1. 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.
  2. 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).
  3. 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).
  4. restart the local server, and you should have the data from the server in your local server.

HTH.

like image 146
emgsilva Avatar answered Oct 23 '22 17:10

emgsilva