-
-
Save hemantbadhe/d86689528f5430f6089d188bb2270c77 to your computer and use it in GitHub Desktop.
Mongo dump/restore with docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Backup DB | |
| docker run \ | |
| --rm \ | |
| --link running_mongo:mongo \ | |
| -v /data/mongo/backup:/backup \ | |
| mongo \ | |
| bash -c ‘mongodump --out /backup --host $MONGO_PORT_27017_TCP_ADDR’ | |
| # Download the dump | |
| scp -r USER@REMOTE:/data/mongo/backup ./backup | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Restore DB | |
| # upload file | |
| scp -r ./backup USER@REMOTE:/data/mongo/backup | |
| docker run \ | |
| --rm \ | |
| --link running_mongo:mongo \ | |
| -v /data/mongodb/backup:/backup \ | |
| mongo \ | |
| bash -c ‘mongorestore /backup --host $MONGO_PORT_27017_TCP_ADDR’ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment