Backup and Restore in MOngoDB 4.2 Sharded Cluster


I would like to confirm the statement below:

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.

Are we not allowed to use mongodump and restore on a running mongodb database in a production environment?

Hi @Ralph_Anthony_Plante

You definitely can use mongodump & mongorestore in production. The statement was saying that if there are sharded transaction in progress, then the backup will contain things that are in flight inside the transaction, and thus the backup do not provide a consistent view of the database.

Having said that, it’s best if you stop all writes while mongodump is in progress anyway, just to be sure that you’re not backing up an inconsistent view of database.

Best regards

1 Like