kubernetesmongodb

Backup and restore MongoDB(R) deployments

Improve this page by contributing to our documentation.

Two different approaches are available to back up and restore Bitnami MongoDB® Helm chart deployments on Kubernetes:

  • Back up the data from the source deployment and restore it in a new deployment using MongoDB® built-in backup/restore tools.
  • Back up the persistent volumes from the source deployment and attach them to a new deployment using Velero, a Kubernetes backup/restore tool.

Method 1: Backup and restore data using MongoDB® built-in tools

This method involves the following steps:

  • Use the mongodump tool to create a snapshot of the data in the source cluster.
  • Create a new MongoDB® Cluster deployment and forward the MongoDB® Cluster service port for the new deployment.
  • Restore the data using the mongorestore tool to import the backup to the new cluster.

NOTE: Under this approach, it is important to create the new deployment on the destination cluster using the same credentials as the original deployment on the source cluster.

Method 2: Back up and restore persistent data volumes

This method involves copying the persistent data volumes for the MongoDB® nodes and reusing them in a new deployment with Velero, an open source Kubernetes backup/restore tool. This method is only suitable when:

This method involves the following steps:

  • Install Velero on the source and destination clusters.
  • Use Velero to back up the PersistentVolumes (PVs) used by the deployment on the source cluster.
  • Use Velero to restore the backed-up PVs on the destination cluster.
  • Create a new deployment on the destination cluster with the same chart, deployment name, credentials and other parameters as the original. This new deployment will use the restored PVs and hence the original data.

Refer to our detailed tutorial on backing up and restoring MongoDB® chart deployments on Kubernetes, which covers both these approaches, for more information.