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-dump
mongodump --host my-source-db.mongodbdns.com --port 27000 --username joao --password xpto --authenticationDatabase devops --db core --out /source-db-dump/
-
Now restore the
core
db from the dummped foldersource-db-dump
mongorestore --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),
core
db from the dummped foldersource-db-dump
mongorestore --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