Atomicity for backup using mongodump

In MongoDB 4.2 release notes, I see below lines which states that mongodump is not reliable for backup as atomicity cannot be guaranteed. Will acquiring lock using fsyncLock before backup help here?

mongodump and mongorestore cannot be part of a backup strategy for 4.2+ sharded clusters that have sharded transactions in progress, as backups created with mongodump do not maintain the atomicity guarantees of transactions across shards.
For 4.2+ sharded clusters with in-progress sharded transactions, use one of the following coordinated backup and restore processes which do maintain the atomicity guarantees of transactions across shards:

Hi Akshaya,

The info you quoted is specific to sharded clusters that may have sharded transactions in progress. The following paragraph on that documentation page suggests recommended alternatives: mongodump for sharded clusters.

Note that mongodump is generally not a recommended backup strategy where the uncompressed data being backed up is significantly larger than RAM. The mongod process has to read all data to be dumped through memory, so mongodump can have a significant impact on the working set and performance of an active deployment.

See MongoDB Backup Methods for an overview of supported backup approaches.


Thanks @Stennie , but I do not want to use any 3rd party tool as an alternative. And I want to just dump a database from one cluster and restore it to another cluster.

Hi ,
please can someone help with this requirement. Thanks in advance.

If your cluster is not sharded you can use mongodbump with the caveat outlined above that it may impact performance for other users during the dump process.

Thanks Joe. But I am using sharded cluster in my case.

I was looking into this as well, and basically even though you can still use mongodump, it seems that there is just no way to use mongodump for consistent, atomic backups when you are using sharded clusters.

To do that right with an on-premise deployment you need to install our commercial product Ops Manager which includes a tool for doing consistent backups of sharded clusters.

Our recommendation for most customers is to run your sharded cluster in MongoDB Atlas if you can. It has all the backup technology built in.