fernandoneto/docker-mysql-backup-azure

语言: Shell

git: https://github.com/fernandoneto/docker-mysql-backup-azure

使用此映像,您可以将docker容器内的mysql-databases备份到Azure存储
With this image you are able to backup mysql-databases inside docker container to Azure storage
README.md (中文)

泊坞窗-mysql的备份,蔚蓝

容器将mysql数据库备份到Microsoft Azure存储。

容器启动解释

  • 您可以在两种模式下运行此容器: ONE_SHOOT - 容器将备份您的数据库并停止 CONTINUOUS - 容器将启动并使用cronjob来安排备份窗口,并将一直运行直到您停止它。
  • Mysql将访问要备份的数据库所在的主机
  • Mysql会将数据库转储到此容器并使用gzip压缩它
  • 使用azure-cli,该文件将上载到Azure存储

环境变量

  • $ DB_PASSWORD - 与Mysql连接的密码
  • $ DB_USER - 用于连接Mysql的用户名
  • $ DB_NAME - 数据库名称
  • $ CONTAINER - 天蓝色的容器名称
  • $ AZURE_STORAGE_ACCOUNT - Azure Storare帐户的名称
  • $ AZURE存储访问密钥 - 存储帐户的访问密钥
  • $ MYSQL_PORT - 用于连接Mysql的端口。默认3306
  • $ MYSQL_HOST - 正在运行mysql的主机
  • $ FILENAME - Azure存储中的文件名。默认名称default-date +“%Y-%m-%d_%H-%M”输出示例default-2015-08-03_17-58
  • $ ONE_SHOOT - 如果为true,则容器进行备份并退出,否则容器仍在运行并在crontab中安排作业。默认为false 备份窗口。
  • $ BACKUP_WINDOW - 备份运行的时间。你应该使用crontab格式,所以请参阅[documentation](http://www.freebsd.org/cgi/man.cgi?crontab(5)。默认值每天早上6点。
  • $ DEBUG - 如果为true,将为您提供终端中所有变量的值。默认为false
  • $ NO_PASSWORD - 无密码连接到Mysql-Host,默认为false

运行示例

docker run -rm --name mysql-backup \
-e "DB_PASSWORD=backup" \
-e "DB_USER=backup" \
-e "DB_NAME=backup" \
-e "ONE_SHOOT=true" \
-e "FILENAME=backup"
-e "AZURE_STORAGE_ACCOUNT=teste-azure"
-e "AZURE_STORAGE_ACCESS_KEY=ashdgashdgasdsa--dadcdsfsd/sdfd--"
-e "CONTAINER=sql-backup" \
-e "MYSQL_HOST=test.mysql.com" \
fernandoneto/docker-mysql-backup-azure:latest

这将上传到Azure Storare一个名为default-2015-08-04_09-47.sql.gz的文件,然后将其上传到 容器会停下来。

建筑图像

docker build -t fernandoneto/docker-mysql-backup-azure .

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Docker-mysql-backup-azure

container to backup your mysql database's to Microsoft Azure Storare.

Container startup explained

  • You can run this container in 2 modes:
    • ONE_SHOOT - the container will backup your db and stop
    • CONTINUOUS - the container will start and use a cronjob to schedule a backup window and will run until you stop it.
  • Mysql will acess to the host where is database you want to backup
  • Mysql will dump the database to this container and compress it using gzip
  • Using azure-cli the file will be uploaded to Azure Storage

Environment variables

  • $DB_PASSWORD - The password to connect with Mysql
  • $DB_USER - The username to connect with Mysql
  • $DB_NAME - Database name
  • $CONTAINER - Container name in azure
  • $AZURE_STORAGE_ACCOUNT - Name of Azure Storare Account
  • $AZURE_STORAGE_ACCESS_KEY - Acess Key for Storage Account
  • $MYSQL_PORT - Port to connect with Mysql. default 3306
  • $MYSQL_HOST - Host where mysql is running
  • $FILENAME - Name to file in Azure Storage. Default name default-date +"%Y-%m-%d_%H-%M" output example default-2015-08-03_17-58
  • $ONE_SHOOT - If true the container make the backup and exit, else the container still running and schedule a job in crontab. default false
    a backup window.
  • $BACKUP_WINDOW - What time should backup run. you should use crontab format, so see [documentation](http://www.freebsd.org/cgi/man.cgi?crontab(5). default value every day at 6 am.
  • $DEBUG - If true will give you the value of all variables in terminal. default to false
  • $NO_PASSWORD - Connect to Mysql-Host without password, default to false

Example of running

docker run -rm --name mysql-backup \
-e "DB_PASSWORD=backup" \
-e "DB_USER=backup" \
-e "DB_NAME=backup" \
-e "ONE_SHOOT=true" \
-e "FILENAME=backup"
-e "AZURE_STORAGE_ACCOUNT=teste-azure"
-e "AZURE_STORAGE_ACCESS_KEY=ashdgashdgasdsa--dadcdsfsd/sdfd--"
-e "CONTAINER=sql-backup" \
-e "MYSQL_HOST=test.mysql.com" \
fernandoneto/docker-mysql-backup-azure:latest

This will upload to Azure Storare a file named default-2015-08-04_09-47.sql.gz and after that the
container will stop.

Building image

docker build -t fernandoneto/docker-mysql-backup-azure .