MongoDB Dump and Restore a Database
Simple receipt with the commands used to Dump and sequentially Restore a MongoDB Cluster
Step by Step Instructions
Assuming in you are ssh'ed into an ubuntu 16 based machine
-
Dump the Source Database into a folder called
source-db-dumpmongodump --host my-source-db.mongodbdns.com --port 27000 --username joao --password xpto --authenticationDatabase devops --db core --out /source-db-dump/ -
Now restore the
coredb from the dummped foldersource-db-dumpmongorestore --host my-destination-db.mongodbdns.com --port 27000 --username joao --password xpto --authenticationDatabase devops --db core --out /home/ubuntu/source-db-dump/core -
You can restore to other destinations also (eg. Atlas),
coredb from the dummped foldersource-db-dumpmongorestore --host my-atlas-shard-0/my-atlas-shard-00-00-qruor.gcp.mongodb.net:27017,my-atlas-shard-00-01-qruor.gcp.mongodb.net:27017,my-atlas-shard-00-02-qruor.gcp.mongodb.net:27017 --ssl --username joao --password xpto --authenticationDatabase admin -d core /home/ubuntu/7dec/source-db-dump
Created on 2/25/2019