You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
2.2 KiB

10 years ago
10 years ago
10 years ago
10 years ago
  1. # mysql-backup-s3
  2. Backup MySQL to S3 (supports periodic backups & mutli files) using AWS CLI v2.
  3. Forked from https://github.com/schickling/dockerfiles.
  4. ## Basic usage
  5. ```sh
  6. $ docker run -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 schickling/mysql-backup-s3
  7. ```
  8. ## Environment variables
  9. - `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)
  10. - `MYSQLDUMP_DATABASE` list of databases you want to backup (default: --all-databases)
  11. - `MYSQL_HOST` the mysql host *required*
  12. - `MYSQL_PORT` the mysql port (default: 3306)
  13. - `MYSQL_USER` the mysql user *required*
  14. - `MYSQL_PASSWORD` the mysql password *required*
  15. - `MYSQL_PASSWORD_FILE` path to file containing the mysql password; alternative to `MYSQL_PASSWORD`
  16. - `S3_ACCESS_KEY_ID` your AWS access key *required*
  17. - `S3_ACCESS_KEY_ID_FILE` path to file containing your AWS access key; alternative to `S3_ACCESS_KEY_ID`
  18. - `S3_SECRET_ACCESS_KEY` your AWS secret key *required*
  19. - `S3_SECRET_ACCESS_KEY_FILE` path to file containing your AWS secret key; alternative to `S3_SECRET_ACCESS_KEYs`
  20. - `S3_BUCKET` your AWS S3 bucket path *required*
  21. - `S3_PREFIX` path prefix in your bucket (default: 'backup')
  22. - `S3_FILENAME` a consistent filename to overwrite with your backup. If not set will use a timestamp.
  23. - `S3_REGION` the AWS S3 bucket region (default: us-west-1)
  24. - `S3_ENDPOINT` the AWS Endpoint URL, for S3 Compliant APIs such as [minio](https://minio.io) (default: none)
  25. - `S3_S3V4` set to `yes` to enable AWS Signature Version 4, required for [minio](https://minio.io) servers (default: no)
  26. - `MULTI_FILES` Allow to have one file per database if set `yes` default: no)
  27. - `SCHEDULE` backup schedule time, see explainatons below
  28. ### Automatic Periodic Backups
  29. You can additionally set the `SCHEDULE` environment variable like `-e SCHEDULE="@daily"` to run the backup automatically.
  30. More information about the scheduling can be found [here](http://godoc.org/github.com/robfig/cron#hdr-Predefined_schedules).