Skip to content

Docker image to periodically backup mysql data to s3

License

Notifications You must be signed in to change notification settings

hotgatecombr/mysql-backup-s3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mysql-backup-s3

Docker Image Version (latest by date) Docker Image Size (tag) Docker Pulls

Periodicaly backup MySQL to S3.

Usage

$ docker run -e SCHEDULE="0 0 * * *" -e S3_ACCESS_KEY_ID=key -e S3_SECRET_ACCESS_KEY=secret -e S3_BUCKET=my-bucket -e S3_PREFIX=backup -e MYSQL_USER=user -e MYSQL_PASSWORD=password -e MYSQL_HOST=localhost -e MYSQL_DATABASE=my-db f213/mysql-backup-s3

docker-compose:

services:
  mysql_backup:
    image: f213/mysql-backup-s3
    environment:
    SCHEDULE: 30 13 * * * # every day at 13:30
    S3_PREFIX: mysql
    MYSQLDUMP_DATABASE: my-db
    MYSQL_HOST: localhost
    MYSQL_USER: user
    MYSQL_PASSWORD: password
    S3_ACCESS_KEY_ID: key
    S3_SECRET_ACCESS_KEY: secret
    S3_BUCKET: my-bucket

Environment variables

  • SCHEDULE crontab-like syntax to schedule your backups

  • SUCCESS_WEBHOOK url to notify on success

  • MYSQLDUMP_OPTIONS mysqldump options (default: --quote-names --quick --add-drop-table --add-locks --allow-keywords --disable-keys --extended-insert --single-transaction --create-options --comments --net_buffer_length=16384)

  • MYSQLDUMP_DATABASE list of databases you want to backup (default: --all-databases)

  • MYSQL_HOST the mysql host required

  • MYSQL_PORT the mysql port (default: 3306)

  • MYSQL_USER the mysql user required

  • MYSQL_PASSWORD the mysql password required

  • S3_ACCESS_KEY_ID your AWS access key required

  • S3_SECRET_ACCESS_KEY your AWS secret key required

  • S3_BUCKET your AWS S3 bucket path required

  • S3_PREFIX path prefix in your bucket (default: 'backup')

  • S3_FILENAME a consistent filename to overwrite with your backup. If not set will use a timestamp.

  • S3_REGION the AWS S3 bucket region (default: us-west-1)

  • S3_ENDPOINT the AWS Endpoint URL, for S3 Compliant APIs such as minio (default: none).

  • S3_S3V4 set to yes to enable AWS Signature Version 4, required for minio servers (default: no)

  • MULTI_DATABASES Allow to have one file per database if set yes default: no)


This project was originally forked from schickling/dockerfiles.

About

Docker image to periodically backup mysql data to s3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 78.6%
  • Dockerfile 21.4%