Mongodump from remote server

You can use with mongodump with --uri

mongodump --uri "mongodb://usersname:[email protected]:27100/dbname?replicaSet=replica_name&authSource=admin" --out "C:\Umesh"

All your collections will store inside the out folder it will create directory name as your Database name and all the collections are bson and metadata will store as json format.

For restore

mongorestore --uri "mongodb://usersname:[email protected]:27100/dbname?replicaSet=replica_name&authSource=admin" -d dbname mongodbumppath

Try this it will work.



This worked for me.

Reference: https://docs.mongodb.com/manual/reference/program/mongodump


Syntax 1:

mongodump --host <hostname:port> --db <database> --username <username> --password <password> --out <path>

Syntax 2:

mongodump -h <hostname:port> -d <database> -u <username> -p <password> -o <path>



Example 1:

mongodump --host 127.0.0.1:27017 --db db_app --username root --password secret --out /backup/db/app-17-03-07

Example 2:

mongodump -h 127.0.0.1:27017 -d db_app -u root -p secret -o /backup/db/app-17-03-07

mongo client can parse MongoDB connection string URI, so instead of specifying all connection parameters separately you may pass single connection string URI.

In your case you're trying to pass connection URI as a host, but 127.0.0.1/development is not a valid host name. It means you should specify database parameter separately from the host:

mongodump --host 127.0.0.1 -d development --port 27017 --username user --password pass --out /opt/backup/mongodump-2013-10-07-1