Last active
January 10, 2022 12:30
-
-
Save keepitsimple/d112615ccb620569c151201e85217791 to your computer and use it in GitHub Desktop.
Docker-compose: create mongo dump as local archive and restore MongoDB from archive
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
# Make mongodb backup as gzipped archive -T very important if you use docker-compose | |
docker-compose exec -T [mongo service name] mongodump --db=[dbname] --gzip --archive|cat >dump_$(date '+%d-%m-%Y_%H-%M-%S').gz | |
#Restore mongodb from gzipped archive | |
docker-compose exec -T mongo mongorestore --archive --gzip < dump_xxx.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment