Docker image to backup MySQL or MariaDB (or PerconaDB) database to S3 using mysqldump and compress using pigz.
- Supports custom S3 endpoints (e.g. minio)
- Uses piping instead of tmp file
- Compression is done with pigz (parallel gzip)
- Creates bucket if it's not created
- Can be run in Kubernetes or Docker
- Possibility to detect and backup all databases [testing]
- PGP encryption
- Available
COMPRESS=
methods: pigz, xz, bzip2, lrzip, brotli, zstd - TODO: Add other dbs (e.g. postgres, mysql)
S3_BUCK=mysql1-backups
S3_NAME=folder-name/backup-name-prefix
S3_URI=https://s3-key:[email protected]
MYSQL_USER=user
MYSQL_PASSWORD=password
MYSQL_HOST=host-or-service-name
MYSQL_PORT=3307 # (optional) defaults to 3306
MYSQL_MASTERDATA=2 # (optional) defaults to 0
GPG_KEYSERVER=keyserver.ubuntu.com # your hpks keyserver
GPG_KEYID=<key_id> # recipient key, backup will be encrypted if added
COMPRESS=pigz # Available: pigz, xz, bzip2, lrzip, brotli, zstd
COMPRESS_LEVEL=7 # (optional) Compression level of desired compression program defaults to 0
Or see docker-compose.yml
file to run this container with Docker.
See kubernetes-cronjob.yml
file.
[2023-09-24] Switched to mysql-8 client due to compatibility issues with mariadb client.