Cassandra Data Backup & Recovery

single node

nodetool -h 10.10.10.1 snapshot thissnapshotname 

cluster wide Cassandra snapshot

clustertool -h 10.10.10.1 global_snapshot thissnapshotname

The snapshoot data are stored in

/var/lib/cassandra/data/mykeyspace/snapshots/timestamp-thissnapshotname/*.db

delete all Cassandra snapshots of a node

nodetool -h 10.10.10.1 clearsnapshot

To delete all Cassandra snapshots in a cluster

nodetool -h 10.10.10.1 clear_global_snapshot

Restore Cassandra from Backups

Shut down the node to be restored
Clear commitlog: Clear files under the folder

rm /var/lib/cassandra/commitlog/* 

For every keyspace, remove the db files

rm /var/lib/cassandra/data/mykeyspace/*.db

Do not remove the snapshots directory in it
Locate the latest snapshot directory

/var/lib/cassandra/data/mykeyspace/snapshots/timestamp-thissnapshotname

Copy the snapshot to the data directory

cp -p /var/lib/cassandra/data/mykeyspace/snapshots/1304617358646-mylatestsnapshot/* /var/lib/cassandra/data/mykeyspace

Restart the node

Thank’s http://jonathanhui.com/