Learn how to manually back up and restore your Cloud Database for MongoDB.
Managed Databases (also called Cloud Databases) allow you to focus on building and deploying cloud applications while OVHcloud takes care of the database infrastructure and maintenance in operational conditions.
Requirements
- a Public Cloud project in your OVHcloud account
- access to the OVHcloud Control Panel
- a MongoDB database running on your OVHcloud Cloud Databases (this guide can help you to meet this requirement)
- configure your MongoDB instance to accept incoming connections
Concept
Cloud Databases perform automatic daily backups of your databases. However, you might need to perform manual backup and restore operations to double-ensure data safety on your end or, for example, to export and import data across database instances.
Instructions
Ensure you can connect to your database
Follow the guide MongoDB - Connect with CLI to ensure you can connect to your database. That step ensures that IP filtering is set up properly and that you have a suitable service URI available.
Install the MongoDB Database Tools
Follow the official MongoDB documentation to install the MongoDB Database Tools for your platform. You'll need the mongodump
and mongorestore
binaries to enact the rest of this procedure.
Perform a backup of your data
Back up your database to a file using:
The MongoDB user needs to have sufficient privileges to perform the backup operation. This can be ensured by giving this user the backup
role.
This operation might take some time - from a few seconds to a few hours, depending on the amount of data your database holds and your network connection. Once it completes, the file path/to/backup.gz
will hold a backup of your data.
Restore your data from a previous backup
mongorestore
merges dataAfter the restore operation, any data that was stored in your database which isn't also part of the backup file (e.g. other collections or other keys) will be left untouched: That is to say,
mongorestore
merges data from your backup file with preexisting data in the database.Restore your database from a backup using:
The MongoDB user needs to have sufficient privileges to perform the restore operation. This can be ensured by giving this user the restore
role.
Again, depending on the volume of data and your network connection, this operation might take some time. Once it completes, any data contained in your backup file is present in your database.
Go further
For more information and tutorials, please see our other MongoDB and Cloud Databases support guides or explore the guides for other OVHcloud products and services.
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.