There are several methods of doing MongoDB backup, according to the official app site. More precisely, they showcase four different methods, which we will look over further below:
Method #1 for MongoDB backup – with Atlas
The official MongoDB cloud service, called Atlas, offers two methods for backup: the first one, called Continuous Backups, saves changes every few seconds, while the second one, called Cloud Provider Snapshots, provides localized backup storage through the native snapshot functionality.
Method #2 for MongoDB backup – with MongoDB Cloud / Ops Manager
With Cloud Manager, we are talking about a hosted backup, as well as a monitoring and automation service. On the other hand, with Ops Manager, users can install and run the same software that powers the Cloud Manager on their hardware. However, this method is only available for Enterprise Advanced subscribers.
Method #3 for MongoDB backup – by copying underlying data files
This option has two further viable methods: MongoDB backup with filesystem snapshots, and with cp or rsync. If the storage system you use doesn’t allow snapshots, you can copy the files directly using cp, rsync or a similar tool. However, you should make sure that you don’t copy files in an invalid state, by stopping all writes to the MongoDB before pursuing this operation.
Method #4 for MongoDB backup – with Mongodump
Last, but not least, Mongodump reads data from MongoDB databases and creates a high fidelity BSON file, which can be used to further populate a MongoDB database. Mongodump and Mongorestore are easy to use and very effective tools, but they shouldn’t be used when dealing with larger system backups.