Cassandra uses the nodetool utility for backup and recovery

What is nodetool?

nodetool is a tool for Cassandra that can be used to perform various operations, including backups, restores, data column statistics, and node status checks.

Backup with nodetool

steps

1. Perform backup with nodetool

nodetool -p  -c  -f backup.cql
  • <node_name>: Points to the Cassandra node you want to backup.
  • <table_name>: Specifies the data table or partition-level name.
  • The -f (-file) option is used to specify the location of the backup file.

2. Perform backup with Cassandadeep tool

cassandadeep -h  -t  -d backup_cql.dump
  • <node_name>: Points to the Cassandra node you want to backup.
  • <table_name>: Specifies the data table or partition-level name.
  • The -d (-dump) option is used to specify the output file path.

Restore with nodetool

steps

1. Restore with nodetool

nodetool -p  -c  -f backup.cql -r
  • <node_name>: Points to the Cassandra node you want to restore.
  • <table_name>: Specifies the data table or partition-level name.
  • The -r (-restore) option is used to start the restore process.

2. Restore with Cassandadeep tool

cassandadeep -h  -t  -d backup_cql.dump -r
  • <node_name>: Points to the Cassandra node you want to restore.
  • <table_name>: Specifies the data table or partition-level name.
  • The -r (-restore) option is used to start the restore process.

Tips

  • Ensure the backup file exists and has readable permissions.
  • Before executing restore commands, check the node status and health to ensure the restore will not cause any issues.