MySQL backup application with cron job.
- Written in Node.js/TypeScript.
- Support multiple MySQL servers and databases.
- Dockerized.
Copy config-example.yml to config/config.yml and edit it.
cronTime: "*/5 * * * *" # Cron time for backup task
defaultKeep: 7 # Default number of keep backups
outputDir: backups # Output directory for backups
instances: # Instances to backup
- host: 127.0.0.1 # Hostname or IP address of MySQL server
port: 3306 # Port of MySQL server
user: root # Username of MySQL server
password: P@ssw0rd # Password of MySQL server
databases: # Databases to backup
- name: database_name # Database name to backup
keep: 5 # Number of keep backups for this database
Note: If the config file was changed, you should restart the application or container to reload configuration.
docker-compose.yml file:version: "3.8"
services:
BackupMySQL:
image: shinchven/backup-mysql
container_name: backup-mysql
restart: always
environment:
- TZ=Asia/Shanghai
volumes:
- ${PWD}/config:/usr/src/app/config # Config file directory
- ${PWD}/backups:/usr/src/app/backups # Backup file directory
docker-compose up -d
ts-node src/index.ts
Content type
Image
Digest
sha256:7443eff71…
Size
176.2 MB
Last updated
almost 4 years ago
docker pull shinchven/backup-mysql