MySQL database backup tool using Amazon Glacier (with glacier-cli) and docker
612

This tool provides a command line interface to create periodic backups of your MySQL databases and upload them to Amazon Glacier for archiving and long-term backup.
docker pull hardware/mysql-glacier
mkdir -p ~/.config/mysql-glacier
Inside your shell config file, add a new alias :
alias glacier='docker run --rm -i \
--env-file ~/.config/mysql-glacier/.aws \
-v ~/.cache/glacier-cli:/root/.cache/glacier-cli \
hardware/mysql-glacier'
Create an .aws file with your AWS credentials, you’ll need retrieve your Access Key ID
and Secret Access Key from the web-based console, use the IAM module (Identity
and Access Management).
# ~/.config/mysql-glacier/.aws
AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxx
AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxx
Don't forget to set permissions and immutable bit, then source your shell config file :
chmod 600 ~/.config/mysql-glacier/.aws
chattr +i ~/.config/mysql-glacier/.aws
. ~/.bashrc
If this is not already done, create your first vault :
glacier create <vault-name>
You can retrieve your vault list :
glacier list
Now, run a backup :
docker run --rm -i \
--env-file ~/.config/mysql-glacier/.aws \
-e "GLACIER_VAULT_NAME=myvault" \
-e "DBHOST=mysqldb" \
-e "DBPORT=3306" \
-e "DBNAME=forum" \
-e "DBUSER=forum" \
-e "DBPASS=xxxxx" \
-e "DBSITE=myAwesomeWebsite" \
-v ~/.cache/glacier-cli:/root/.cache/glacier-cli \
--link mysqldb:mysqldb \
hardware/mysql-glacier
> Generating backup for mysqldb:3306/myAwesomeWebsite->forum
> Vault synchronisation
> Sending backup to your vault 'myvault'
> Clean local backup
> Done !
List all your backups :
glacier backup-list <vault-name>
myAwesomeWebsite-forum-2016-01-30_23-47.sql
myAwesomeWebsite-mail-2016-01-30_22-23.sql
myAwesomeWebsite-chat-2016-01-30_21-58.sql
Remove a backup :
glacier backup-delete <vault-name> <backup-name>
glacier backup-delete <vault-name> <id:xxxxxxxxx>
Content type
Image
Digest
Size
99.7 MB
Last updated
over 10 years ago
docker pull hardware/mysql-glacier