Mongodb Backup and Restore

1)      Cmd path

Find the path in your computer with include mongodump.exe and mongorestore.exe

2)      Backup script

-h host

-d database name

-o output path in your computer

--username –password add it inneed

Example:

DEV: mongodump -h 10.10.5.20:27017 -d test -o C:mongoin111dockerDev

SIT: mongodump -h ds023520.mlab.com:23520 --username esquel --password pw123456 -d lpd-fabric-development_sit -o C:mongoin111sit

After backup, there will be a backup folder in your output path

3)      Restore script:

Same as backup script, example:

DEV: mongorestore -h 10.10.5.20:27017 -d test C:mongoin111dockerDev est

SIT: mongodump -h ds023520.mlab.com:23520 --username esquel --password pw123456 -d lpd-fabric-development_sit  C:mongoin111sit lpd-fabric-development_sit

原文地址:https://www.cnblogs.com/weschen/p/7765432.html