Toggle Menu

Automating Backup of Cassandra Clusters in Kubernetes with Medusa

Backing up and restoring a distributed database like Apache™ Cassandra can be a challenging task. This is why the Cassandra community built Medusa - a utility for managing Cassandra backups.

Medusa is a command-line tool for backing up and restoring Apache™ Cassandra databases. K8ssandra integrates Medusa into its ecosystem using a Helm interface. So, you use Helm commands to backup and restore Cassandra data. Medusa is capable of full and incremental backups, as well as backing up specific keyspaces. You can store backup data using a cloud provider such as AWS or GCP, or you can use your own storage manager via Minio, an open-source, Kubernetes-native AWS compatible object storage manager.

Get Started
How does Medusa fit into the K8ssandra ecosystem?

How does Medusa fit into the K8ssandra ecosystem?

Medusa is another useful component in the K8ssandra ecosystem that enables you to perform backups of your Cassandra cluster. Medusa is integrated into K8ssandra with a Helm interface. Medusa stores backup data in a storage manager such as AWS, GCP or Minio. You use a Kubernetes secret holding the storage manager’s credentials to give Medusa access to the storage manager and configure Medusa for the storage manager.

Next: How Do I configure and Install Medusa?

How Do I configure and Install Medusa?

You can use a file to modify the default values for Medusa, and then apply these changes during install, or by performing an upgrade. In the configuration file, you can specify parameters like the storage mechanism, the bucket name and the secret containing the storage credentials.

There are three steps to setting up Medusa within K8ssandra:

With the storage manager setup, the secret created and the configuration file organized, you then use Helm to install or upgrade your K8ssandra cluster configuration.

There are three steps to setting up Medusa within K8ssandra:

  1. Set up a storage manager such as AWS’s S3 and create a bucket (i.e., a storage container within the storage manager).
  2. Create a Kubernetes secret containing the credentials for the storage manager.
  3. Create a Helm configuration file that enables Medusa, and identifies the storage manager, the corresponding secret that contains the credentials for the storage manager, and the target bucket within the storage manager.
Next: How do I perform a backup?
How Do I configure and Install Medusa?
How do I perform a backup?

How do I perform a backup?

Within K8ssandra, you use Helm to perform backup and restore operations. The backup and restore Helm operations are part of the same Helm chart used to install K8ssandra. To perform a backup, you install a Helm release, which creates a CassandraBackup resource representing your backup data. Since your backup data looks like a CassandraBackup CRD, you can use kubectl to list these objects.

A restore command looks a lot like a backup command. It uses Helm with a couple of different options, such as the restore helm chart name and the backup.name option to identify the backup data.

Next: Skill Building

Skill Building

Now you are ready to learn more about backup operations using Medusa

Automating Backup of Cassandra Clusters in Kubernetes with Medusa

Perform backup and restore using Medusa

CONTRIBUTORS

Managing Cassandra backups can be daunting. But Medusa, a component in the K8ssandra ecosystem, simplifies your life considerably!

In this scenario, we will:

  • Install Minio, an AWS S3 compatible local storage manager
  • Install K8ssandra with Medusa enabled
  • Deploy the sample Pet Clinic app
  • Perform a backup
  • Modify the contents of the Cassandra database using the sample app
  • Restore the database contents to its original state

Let's get started!

Time to Complete

25 minutes

Difficulty

Intermediate

Share

Do you have a suggestion or issue you’ve discovered?

Share Feedback

More Resources

Items related to Kubernetes

K8ssandra docs

K8ssandra docs

An overview of K8ssandra

Learn More
Medusa repo

Medusa repo

Apache Cassandra Backup and Restore Tool

Read More
Blog: TLP's discussion of Medusa

Blog: TLP's discussion of Medusa

Spotify and The Last Pickle : Challenges to Backing Up Cassandra databases

Read More