Apache Cassandra backup is essential for recovering data after accidental deletion, database corruption, infrastructure failure, or cluster migration. Although Cassandra distributes data across multiple nodes, replication alone cannot replace a reliable backup and restore strategy.
Cassandra provides native snapshot and incremental backup mechanisms based on SSTable files. For larger distributed environments, administrators can also use tools such as Medusa to automate cluster-wide backups, manage backup storage, and coordinate recovery operations.
Apache Cassandra is a distributed NoSQL database that stores data across multiple nodes. Its architecture provides high availability through replication, but a complete backup strategy must account for data placement, table schemas, cluster topology, and recovery requirements.
Cassandra stores persistent table data in immutable files called SSTables (Sorted String Tables). Native backup operations preserve these files without requiring a conventional SQL database dump.
Unlike many relational databases, Cassandra does not rely on a single database file or one centralized backup location. A cluster-wide backup generally requires coordinated operations across the relevant nodes.
Replication maintains copies of data across Cassandra nodes, helping the cluster remain available when individual nodes fail. However, unwanted changes can also propagate between replicas.
Separate backups provide recovery options that replication alone cannot offer.
Apache Cassandra provides native snapshots and incremental backups. These mechanisms work differently and are commonly combined in a broader database backup strategy.
| Method | How It Works | Typical Use |
|---|---|---|
| Snapshots | Creates hard links to existing SSTable files at a particular point in time. | Periodic recovery points, table recovery, and migration. |
| Incremental Backups | Creates hard links to SSTables when they are flushed or streamed locally. | Preserving SSTables created between snapshots. |
| Commit Log Archiving | Preserves commit log segments that can be used in specialized recovery workflows. | More granular recovery procedures when correctly configured. |
| Cluster Backup Tools | Coordinates snapshots, metadata, external storage, and restore operations. | Automated backup of distributed Cassandra environments. |
Important: A native Cassandra incremental backup is not the same as a conventional incremental file backup. Cassandra preserves SSTables created after data flushes rather than comparing ordinary files against a previous backup set.
The nodetool snapshot command creates a point-in-time snapshot of selected tables or keyspaces. Cassandra normally flushes in-memory data before creating the snapshot, unless the skip-flush option is explicitly selected.
Snapshots use hard links to existing SSTable files, so creating one does not immediately duplicate the entire database on disk. However, retained snapshots can prevent obsolete SSTable data from being reclaimed after compaction.
Because snapshots are stored within Cassandra data directories, they should be transferred to separate storage for long-term retention and disaster recovery.
Create a snapshot of a keyspace named sales:
nodetool snapshot -t sales_daily sales
Create a snapshot of one table:
nodetool snapshot -t orders_daily -cf orders sales
List existing snapshots:
nodetool listsnapshots
These commands operate on the node contacted by nodetool. For a cluster-wide backup, the required nodes must be included in the backup procedure.
See the official nodetool snapshot reference for command options and version-specific behavior.
Incremental backups preserve SSTable files created after memtables are flushed to disk. They are disabled by default in standard Cassandra configurations and must be enabled explicitly.
In the Cassandra configuration file cassandra.yaml, set:
incremental_backups: true
Alternatively, enable incremental backups on a running node:
nodetool enablebackup
Check the current status:
nodetool statusbackup
Disable incremental backups when necessary:
nodetool disablebackup
Once enabled, Cassandra creates hard links to SSTable files in a backups subdirectory associated with each table.
These files can be combined with a suitable snapshot to recover changes represented by subsequent SSTables. Unlike a snapshot, an incremental backup does not automatically provide a complete independent recovery point.
Incremental backup files also require retention management. Cassandra does not automatically remove all files from incremental backup directories after they have been transferred to external storage.
For more information on general backup chains, see Incremental Backup Methods and Recovery.
A Cassandra cluster contains distributed data, so backing up a single node does not necessarily preserve every partition. Cluster recovery planning must take replication, token ownership, schema information, and the intended restoration method into account.
Document Cassandra versions, data centers, keyspaces, replication settings, node topology, and critical tables. Determine whether the goal is table recovery, full-cluster recovery, or migration to another environment.
Run snapshot operations on the relevant nodes. Use a consistent backup identifier and record completion times and results.
Individual node snapshots are not automatically a globally synchronized transaction-consistent snapshot of the entire cluster.
Keep the CQL schema definitions and important configuration details alongside the backup. Recovery may require keyspace definitions, table structures, replication settings, and other metadata.
Transfer the required snapshot files and metadata to storage independent of the Cassandra nodes. Preserve the association between backup files, source nodes, keyspaces, and tables.
Define how long full snapshots and incremental SSTables must be retained. Ensure that files needed for a particular recovery point remain available until that backup is no longer required.
Perform a trial restoration in an isolated environment. Verify the schema, sample records, application queries, and the completeness of restored data.
Note: Coordinated cluster backup tools can simplify these procedures. For production environments, a tested recovery workflow is more important than merely confirming that snapshot commands completed successfully.
Offsite backup storage is particularly important for Cassandra clusters deployed across cloud infrastructure, virtual machines, or dedicated servers. Keeping copies outside the active cluster reduces dependence on the availability of its local disks.
Common destinations include Amazon S3, S3-compatible object storage, Google Cloud Storage, and dedicated backup servers.
A typical workflow creates Cassandra snapshots, collects the required files and metadata, and transfers them to remote storage. The process should account for network bandwidth, storage costs, backup retention, and the time required to retrieve large datasets.
Because Cassandra SSTables may already be compressed, placing every snapshot into a separate compressed archive does not necessarily produce significant storage savings. Incremental transfers and file reuse can be more efficient for large datasets.
Medusa is an open-source backup and restore tool developed for Apache Cassandra. It builds on Cassandra snapshots and adds mechanisms for backup coordination, remote storage, and restoration.
Medusa is especially useful when administrators want to manage backups across multiple Cassandra nodes without manually collecting individual snapshot directories.
Its functionality includes:
Medusa can be useful for production Cassandra environments with multiple nodes, substantial datasets, or requirements for repeatable disaster recovery procedures.
Before deployment, verify compatibility with your Cassandra version, cluster topology, storage environment, and restoration requirements.
Official project repository:
Cassandra recovery depends on the type of backup and the target environment. Restoring one table to an existing cluster is different from rebuilding an entire cluster or migrating data to a cluster with a different topology.
Snapshot recovery uses the SSTable files captured during the backup. Depending on the scenario, administrators can use native Cassandra tools such as sstableloader or nodetool import.
A typical table recovery procedure includes:
Cluster migration introduces additional considerations, including node counts, partition ownership, replication configuration, and Cassandra version compatibility.
The sstableloader utility can stream SSTable data to a target cluster without requiring the same token allocation as the source cluster.
However, the destination schema and cluster configuration must be prepared correctly. A direct file copy between clusters with different layouts is not a universal recovery method.
Store backup data separately from Cassandra production nodes. Use independent storage and appropriate access controls to reduce the impact of infrastructure failures.
Monitor disk utilization, snapshot accumulation, network throughput, and I/O load. Schedule large transfers to avoid unnecessary competition with production workloads.
Restore selected tables and complete datasets in a test environment. Validate application queries, data completeness, and the actual time needed for recovery.
A reliable database backup and recovery strategy should define recovery point objectives (RPO), recovery time objectives (RTO), archive retention, monitoring, and responsibilities for executing recovery procedures.
For additional context, learn about hot database backups and how online backup methods differ from copying database files while the system is stopped.
Cassandra can automatically create snapshots before certain operations, such as truncating or dropping tables, depending on its configuration. However, routine full backup scheduling, remote storage, retention, and recovery verification require additional planning or automation. Incremental backups are disabled by default in standard configurations.
No. Cassandra snapshots preserve a point-in-time set of SSTable files, while incremental backups preserve SSTables created when data is flushed or streamed locally. These mechanisms can be combined, but an incremental backup does not replace the need for a complete baseline and associated recovery metadata.
For a comprehensive cluster backup, administrators generally coordinate snapshots across the relevant nodes. A single node may contain only part of the cluster's data. The exact backup scope depends on replication, token distribution, and the intended recovery procedure. Cluster-wide tools such as Medusa help automate the process.
Yes. Cassandra SSTable backups can be used for recovery or migration to another compatible cluster. Tools such as sstableloader can stream data to the destination cluster. However, administrators must consider schema compatibility, Cassandra versions, replication settings, and differences in cluster topology.
Snapshots provide recovery points corresponding to the captured SSTable state. More granular recovery may require correctly configured commit log archiving and specialized restoration procedures. Cassandra snapshots and incremental SSTable backups alone do not provide arbitrary point-in-time recovery equivalent to database transaction log replay.
The most reliable verification method is a test restoration. Restore the backup to an isolated Cassandra environment, verify the table schemas, compare expected records, and run representative application queries. File-level integrity checks can help detect transfer errors, but they cannot replace database recovery testing.
Explore additional information about database backup planning, storage methods, and recovery procedures: