Backup and Restore specific cassandra tables

Recently, we had to make alterations directly to production cassandra tables due to an urgent bug fix and required to backup and restore specific cassandra tables so that we could roll back incase something gone wrong.

Backup and restoring tables is seamless using nodetool and sstableloader

Cassandra table backup steps

  • Login to Casandra Box
  • Execute the following commands from the cassandra bin directory
   ./nodetool snapshot -cf <tablename> <keyspace>
  • Repeat the same for any other table to be backed up

  • This will create snapshots in the data directory at following locations:


Cassandra table restore steps

  • Login to cassandra box
  • Navigate to following folder

Execute following command

  cp snapshots/<epoch>/*.* .
  • Repeat the same for any other table to be restored

  • Once all the snapshots have been copied to data directory, run following commands in sequence:

  ./nodetool refresh <keyspace> <table>;