Mongodb – Mongodump Backup Resume

mongodbmongodb-3.0mongodb-3.2mongodb-3.6

My database size is approx 1.5 TB and I have approx 2TB free on backup mount point. But after 10 hours my backup fail due to lack of storage and its just 60% complete. Is their any why through which i can resume my backup from the failure point??

mongodump -u admin -p admin -d tex –host xx.xx.xx.xx –authenticationDatabase admin

Do you have any other option then please also share with me.

Best Answer

If you're using the WiredTiger storage engine, data in the database is compressed (using snappy by default). In contrast, mongodump output is not compressed. This is why 2TB may not be enough to backup a 1.5TB database.

To determine the uncompressed size of your database, you can run db.stats().dataSize in the mongo shell (see manual).

To determine the uncompressed collection size, use db.collection.stats().size.

Having said that, there is no built-in way to "resume" a dump. However, you can pass a query into mongodump using --query parameter. If you have some kind of timestamp/ordering field in your collection, you may be able to use this parameter. This could also help you to split up your backup so you don't have to do all 1.5TB at once.

Alternatively, you also can pass --gzip into mongodump as suggested by JJussi to ensure the output is compressed.