A ProxySQL-based MySQL coordinator that provides automatic failover, intelligent request routing, and automated backups.
- ProxySQL integration for MySQL request routing
- Automatic writer/reader hostgroup management
- etcd-based coordination and state management
- Automated backup system with S3 storage
- Backup rotation and retention management
- Comprehensive health monitoring
- Automatic master failover with GTID validation
ETCDCTL_ENDPOINTS
: etcd cluster endpointsETCDCTL_USER
: etcd authentication (format: username:password)MYSQL_REPL_USERNAME
: MySQL replication userMYSQL_REPL_PASSWORD
: MySQL replication passwordPROXYSQL_ADMIN_USER
: ProxySQL admin usernamePROXYSQL_ADMIN_PASSWORD
: ProxySQL admin password
S3_ENDPOINT_URL
: S3-compatible storage endpointS3_BACKUP_BUCKET
: Backup storage bucket nameS3_ACCESS_KEY
: S3 access keyS3_SECRET_KEY
: S3 secret key
CHECK_INTERVAL
: Health check interval in seconds (default: 5)PROXYSQL_WRITER_HOSTGROUP
: Writer hostgroup ID (default: 10)PROXYSQL_READER_HOSTGROUP
: Reader hostgroup ID (default: 20)S3_BACKUP_PREFIX
: Prefix for backup storage path (default: "proxysql/")BACKUP_RETENTION_DAYS
: Number of days to retain backups (default: 30)ETC_PREFIX
: Custom prefix for etcd keys (default: "/mysql")
The coordinator uses the following etcd key structure:
-
/mysql/nodes/<node_id>
: Node information including:- status: online/failed
- role: master/slave
- host: hostname
- port: MySQL port
- last_seen: timestamp
- gtid_position: MySQL GTID position
-
/mysql/topology/master
: Current master node ID -
/mysql/topology/slaves/<node_id>
: Slave information including:- master_node_id: Current master
- replication_lag: Replication delay in seconds
- Automated backups run every 6 hours
- Backups include ProxySQL configuration tables:
- stats_mysql_query_digest
- mysql_query_rules
- mysql_servers
- mysql_users
- stats_mysql_commands_counters
- stats_mysql_connection_pool
- Backup validation with SHA256 checksums
- Configurable retention period
- Compressed backup archives
- Atomic backup operations with locking
Monitor the coordinator logs:
tail -f /var/log/proxysql/backup.log # Backup logs
tail -f /var/log/proxysql/backup_cleanup.log # Cleanup logs
MIT License - See LICENSE file for details