Back up Cassandra on Kubernetes
Follow the procedures in this topic to create pre and post backup rules with Portworx Backup, which take application-consistent backups for Cassandra on Kubernetes in production.
By default, Cassandra is resilient to node failures. However, you need Cassandra backups to recover from the following scenarios:
- Unauthorized deletions
- Major failures that need your cluster rebuild
- Corrupt data
- Point-in-time rollbacks
- Disk failure
Cassandra provides an internal snapshot mechanism to take backups using a tool called nodetool
. You can configure this tool to provide incremental or full snapshot-based backups of the data on the node. The nodetool
flushes data from memtables
to disk and create a hardlink
to the SSTables file on the node.
However, disadvantages of this method are that you must run nodetool
on each and every Cassandra node, and it keeps data locally, increasing the overall storage footprint. Portworx by Pure Storage suggests taking a backup of the Cassandra PVCs at a block level and storing them in a space-efficient object storage target. Portworx allows you to combine techniques that are recommended by Cassandra, such as flushing data to disk with pre and post-backup rules for the application to provide you Kubernetes-native and efficient backups of Cassandra data.
Portworx Backup allows you to set up pre and post backup rules that are applied before and or after a backup occurs. For Cassandra, you can create a custom flush, compaction, or verify rule to ensure a healthy and consistent dataset before and after a backup occurs. Rules can run on one or all pods associated with Cassandra, which is a requirement for nodetool
commands.
For more information on how to run Cassandra on Kubernetes, refer to the Cassandra on Kubernetes on Portworx topic.
Prerequisites
- Cassandra pods must also be using the
app=cassandra
label. - This example uses the cassandra
newkeyspace
keyspace. If you want to use this rule for another keyspace, then replace keyspace with your own keyspace value.