Using https://github.com/klevo/docker-percona/ as base image, this will add
innobackupex
backup mechanism.
Refer to docker-compose.yml
for example.
AWS_ACCESS_KEY
: AWS Access Key to be used when uploading backups to S3 bucketAWS_SECRET_KEY
: AWS Secret Key to be used when uploading backups to S3 bucketMYSQL_ROOT_PASSWORD
: Root password for MySQLS3BUCKET
: Location of the S3 backup. For eg:s3://a-sample-bucket/some/database/backuppath/
INNOBACKUPEX_MEMORY
: Amount of memory allocated for restoring process. Defaulted to1024M
.BACKUPDIR
: Location of the backup in the container. Defaulted to/backup/mysql
.
innobackupex
is scheduled to run every 2 hours.- When it is running, it will perform either full or incremental backup into local filesystem.
- Then, it will sync the folder to specified S3 bucket.
-
If the Docker container is totally destroyed, copy from S3 backup path
S3BUCKET
intoBACKUPDIR
directory in the container.s3cmd cp $S3BUCKET $BACKUPDIR
-
rm -rf /var/lib/mysql/*
-
Run
innobackupex-restore
, specifying the first parameter from the targetted backup. This can be either full or incremental backup.innobackupex-restore $BACKUPDIR/full/2015-03-17_07-59-45/ innobackupex-restore $BACKUPDIR/incr/2015-03-17_07-59-45/2015-03-17_06-43-18/