MongoDB.live, free & fully virtual. June 9th - 10th. Register Now MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Atomicity for backup using mongodump

Hi,
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.

Regards,
Stennie

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.