项目作者: dimkk

项目描述 :
This image runs mongodump to backup data using cronjob to folder `/backup` and azure storage service
高级语言: Shell
项目地址: git://github.com/dimkk/azure-docker-mongodb-backup.git
创建时间: 2017-03-26T08:42:30Z
项目社区:https://github.com/dimkk/azure-docker-mongodb-backup

开源协议:

下载


mongodb-azure-backup

This image runs mongodump to backup data using cronjob to folder /backup and azure storage service

Usage:

  1. docker run -d \
  2. --env MONGODB_HOST=mongodb.host \
  3. --env MONGODB_PORT=27017 \
  4. --env MONGODB_USER=admin \
  5. --env MONGODB_PASS=password \
  6. --volume host.folder:/backup \
  7. --env AZ_USER=[Application ID GUID] \
  8. --env AZ_SECRET=[Application KEY] \
  9. --env AZ_AD_TENANT_ID=[Tenant AD ID GUID] \
  10. --env AZ_STORAGE_SHARE=[Share name] \
  11. --env AZ_STORAGE_FOLDER=[Folder to save] \
  12. --env AZ_STORAGE_CS=[Storage connection string]
  13. dimkk/azure-docker-mongodb-backup

Moreover, if you link dimkk/azure-docker-mongodb-backup to a mongodb container(e.g. tutum/mongodb) with an alias named mongodb, this image will try to auto load the host, port, user, pass if possible.

  1. docker run -d -p 27017:27017 -p 28017:28017 -e MONGODB_PASS="mypass" --name mongodb tutum/mongodb
  2. docker run -d --link mongodb:mongodb -v host.folder:/backup tutum/mongodb-backup

Parameters

  1. MONGODB_HOST the host/ip of your mongodb database
  2. MONGODB_PORT the port number of your mongodb database
  3. MONGODB_USER the username of your mongodb database. If MONGODB_USER is empty while MONGODB_PASS is not, the image will use admin as the default username
  4. MONGODB_PASS the password of your mongodb database
  5. MONGODB_DB the database name to dump. If not specified, it will dump all the databases
  6. EXTRA_OPTS the extra options to pass to mongodump command
  7. CRON_TIME the interval of cron job to run mongodump. `0 0 * * *` by default, which is every day at 00:00
  8. MAX_BACKUPS the number of backups to keep. When reaching the limit, the old backup will be discarded. No limit, by default
  9. INIT_BACKUP if set, create a backup when the container launched
  10. AZ_USER azure application guid, to get it, and AZ_SECRET, if set, azure save/delete will work [read here](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal)
  11. AZ_SECRET azure application secret
  12. AZ_AD_TENANT_ID azure Active Directory Tenant ID, you can find it here -> https://manage.windowsazure.com/serco.onmicrosoft.com#Workspaces/ActiveDirectoryExtension/Directory/**<Tenant ID GUID>**/directoryQuickStart
  13. AZ_STORAGE_FOLDER azure folder in share to save backups
  14. AZ_STORAGE_SHARE azure share name - create it yourself!
  15. AZ_STORAGE_CS azure storage connection string

Restore from a backup

See the list of backups, you can run:

  1. docker exec tutum-backup ls /backup

To restore database from a certain backup, simply run:

  1. docker exec tutum-backup /restore.sh /backup/2015.08.06.171901