Skip to content

Backup and restore#


This guide has only been tested on single node Cassandra server



To backup or export database from Cassandra, following information are required:

  • Cassandra admin password

  • keyspace used by thehive (default = thehive). This can be checked in the application.confconfiguration file, in the database configuration in storage, cql and keyspace attribute.

    db.janusgraph {
      storage {
        backend: cql
        hostname: [""]
        cql {
          cluster-name: thp
          keyspace: thehive

Considering that your keyspace is thehive and backup_name is the name of the snapshot, run the following commands:

  1. Before taking snapshots

    nodetool cleanup thehive
  2. Take a snapshot

    nodetool snapshot thehive -t backup_name
  3. Create and archive with the snapshot data:

    tar cjf backup.tbz /var/lib/cassandra/data/thehive/*/snapshots/backup_name/
  4. Remove old snapshots

    nodetool -h localhost -p 7199 clearsnapshot -t <snapshotname>


  1. Unarchive backup files:

    tar jxf /PATH/TO/backup.tbz -C /
  2. And restore snapshots files:

    cd /var/lib/cassandra/data/thehive
    for I in `ls /var/lib/cassandra/data/thehive`  ; do cp /var/lib/cassandra/data/thehive/$I/snapshots/backup_name/* /var/lib/cassandra/data/thehive/$I/ ; done
  3. Ensure Cassandra user keep ownership on the files:

    chown -R cassandra:cassandra /var/lib/cassandra/data/thehive
  4. Restart services

    service cassandra restart
    service thehive restart

Ensure no Commitlog file exist before restarting Cassandra service. (/var/lib/cassandra/commitlog)

Last update: March 2, 2021 17:57:33