Skip to content

Mysql or MariaDB backup container for kubernetes and docker with custom s3 endpoint ability (e.g. minio, ceph)

Notifications You must be signed in to change notification settings

BackupTools/mysql-backup-s3

Repository files navigation

MySQL/MariaDB S3 docker/kubernetes backup

Build status Pulls

Docker image to backup MySQL or MariaDB (or PerconaDB) database to S3 using mysqldump and compress using pigz.

Advantages/features

  • 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)

Configuration

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.

Cron backup with kubernetes

See kubernetes-cronjob.yml file.

Changelog

[2023-09-24] Switched to mysql-8 client due to compatibility issues with mariadb client.

About

Mysql or MariaDB backup container for kubernetes and docker with custom s3 endpoint ability (e.g. minio, ceph)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published