Skip to content
forked from soana/backupsql

Simple MySQL backup on a cronjob

Notifications You must be signed in to change notification settings

bille747/backupsql

 
 

Repository files navigation

Description

BackupSQL is a docker container for backing-up your MySQL Server automatically on a cron schedule.

It automatically connects to the MySQL server, gets a list of the user databases and compresses it using Pigz (Multithreaded GZIP).

Note: This container will not backup the following databases:

  • mysql
  • information_schema
  • performance_schema
  • sys

QuickStart

In order to start using this container, simply run the following command:

docker run -d --name "BackupSQL" -e "TZ=America/New_York" -e "bkpMinute=0" -e "bkpHour=3" -e "bkpDayOfMonth=*" -e "bkpMonth=*" -e "bkpDayOfWeek=*" -e "MySQLIP=192.168.2.2" -e "SQL_userid=mysqluser" -e "SQL_pwd=mysqlpass" -e "BackupCopies=8" -v "/path/to/backup/:/backup" bille747/backupsql

Container Parameters

This Docker Container uses the following parameters.

Parameter Function
--name "BackupSQL" The name of the container.
-e "TZ=America/New_York" The timezone of the container. See Wikipedia Article.
-e "bkpMinute=0" The exact minute at which the backup should run (from 0 - 59).
-e "bkpHour=3" The exact hour of the day at which the backup should run (from 0 - 23).
-e "bkpDayOfMonth=*" The exact day of the month at which the backup should be run (from 1 - 31).
Note: Use a * to specify all days of the month.
-e "bkpMonth=*" The exact month at which the backup should beb run (from 1 - 12).
Note: Use a * to specify all months of the year.
-e "bkpDayOfWeek=*" The exact day of the week at which the backup should be run (from 0 - 6).
Note: Use a * to specify all days of the week.
-e "MySQLIP=192.168.2.2" The IP Address (Or hostname) of the MySQL Server you wish to backup.
-e "SQL_userid=mysqluser" The username that the container will use to login to MySQL.
Note: It is best to avoid using root as the backup user. Instead, a seperate backup user should be created with the following global privileges: "SHOW DATABASES", "SELECT", "EVENT", "LOCK TABLE"
-e "SQL_pwd=mysqlpass" The password for the MySQL user.
-e "BackupCopies=8" How many days after a backup was done should the container automatically delete.
-v "/path/to/backup/:/backup" The path to the backup location on your server.

About

Simple MySQL backup on a cronjob

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 68.1%
  • Dockerfile 31.9%