MongoDB Backup and Restore

ScaleGrid automates the process of backing up and restoring your MongoDB instances. With a single click, ScaleGrid will backup or restore a MongoDB instance or replica set. Since ScaleGrid’s fully managed MongoDB hosting uses full backups, all databases, users, and settings are restored on the instance.

MongoDB backups are implemented using point-in-time snapshots, therefore, they take the same amount of time irrespective of the size of the data. This is different from using MongoDump and MongoRestore, where your backup and recovery times increase linearly with the amount of data. Also, backups have no effect on the availability of your database, and your databases will continue to run as normal. ScaleGrid offers both on-demand and scheduled backups for MongoDB. In this post, we’ll talk about MongoDB on-demand backups. If you’re interested in scheduling automated backups for your cluster, refer to our post, Automatic MongoDB Backup.

Backing Up a MongoDB Deployment

All backups are zipped into a single file and stored in your S3 account. Backups through ScaleGrid are full backups and contain all databases present on an instance. When backing up a replica set, ScaleGrid will flush and backup files from the primary. Backing up from the primary ensures no data is lost due to a potential delay in sync with any of the secondaries.

Backing up instances in ScaleGrid is easy. To create an on-demand backup, select the deployment you would like to backup and then click the “Backup” button. Next, provide a name for this backup.

After clicking “Backup”, the status of the deployment will change from “Running” to “BackingUp”.

Restoring a MongoDB Deployment

WARNING: Restoring a MongoDB deployment will override all existing data on the MongoDB instance. Please take a backup before restoring to preserve the existing data.

Restoring a MongoDB deployment will download the zipped backup file from S3 and restore it. In the case of replica sets, data on the secondaries will be reset with the data present on the primary.

Restoring instances in ScaleGrid is easy. To restore a backup, select the deployment you would like to restore and then click the “Restore” button. Next, select the backup you want to restore.

After clicking “Restore”, the status of the deployment will change from “Running” to “Restoring”. Restore time will vary depending on the size of data present in the MongoDB instance. In case of ReplicaSets, all SECONDARIES will be also be synced before the MongoDB deployment is in “Running” state. The MongoDB deployment will also incur downtime during the restoring phase.

As always, if you have any questions, email us at [email protected].