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:\mongo\bin\111\dockerDev

SIT: mongodump -h ds023520.mlab.com:23520 --username esquel --password pw123456 -d lpd-fabric-development_sit -o C:\mongo\bin\111\sit

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:\mongo\bin\111\dockerDev\test

SIT: mongodump -h ds023520.mlab.com:23520 --username esquel --password pw123456 -d lpd-fabric-development_sit  C:\mongo\bin\111\sit\ lpd-fabric-development_sit

posted @ 2020-07-25 16:46  WesChan  阅读(181)  评论(0)    收藏  举报