mongodb-backup
A solution to automate mongodb backup
- https://medium.com/@saiprasanth2007/easy-mongo-backup-solution-to-azure-blob-8fd44d143ede
- https://hub.docker.com/u/sai3010
How it works
- There is a python script
mongo-bkp.py
which connects to mongo db and takes mongo dump. - After the execution of the mongo dump , it zip's the folder by appending current datetime and uploads to azure blob storage.
- It is saved in azure blob as
containername/date/backup_date.zip
- It is saved in azure blob as
- It accepts following environment variables
MONGO_HOST
: Mongo host url.MONGO_USER
: Mongo user is required if mongo is secured with user credentialsMONGO_PASS
: Mongo user's passwordBACKUP_FOLDER
: Name of the root folder to be uploaded in blob storageFILENAME
: zip folder name appended with date and uploaded under backup_folder in blob storageCONTAINER_NAME
: Azure container nameACCOUNT_NAME
: Azure storage account nameACCOUNT_KEY
: Azure storage account key
How to excecute
docker pull sai3010/mongo-azure-backup
docker run --net=host --rm -e MONGO_HOST="localhost" -e BACKUP_FOLDER="test" -e FILENAME="backup" -e CONTAINER_NAME="mongo" -e ACCOUNT_NAME="data" -e ACCOUNT_KEY="Y76I9TacyJALGJLeEw2cIFw" -it mongo-azure-backup
- When the container is run , it connects to mongo , takes a dump and uploads to blob storage.