[MongoDB] Backup with mongodump and Restore with mongorestore

Tadashi Shigeoka ·  Thu, September 19, 2013

I’ll introduce methods for MongoDB backup with mongodump and restore with mongorestore.

MongoDB | モンゴディービー

Backup with mongodump

Backup test_db on localhost.

mongodump --host localhost --db test_db

Backup test_collection in test_db on localhost.

mongodump --host localhost --db test_db --collection test_collection

Restore with mongorestore

Restore all of the backed up test_db.

mongorestore --host localhost --db test_db ./dump/test_db

Restore test_collection from the backed up test_db.

mongorestore --host localhost --db test_db --collection test_collection  ./dump/test_db/test_collection.bson

That’s all from the Gemba.