A production-ready MySQL solution optimized for Akash Network deployments, with robust standalone mode and experimental cluster support.
⚠️ WARNING: Cluster mode is currently a work in progress and should not be used in production environments. Stick to standalone mode for production workloads until cluster mode is fully tested and stable.
- Automatic master/slave failover in cluster mode
- Dynamic configuration optimization based on available resources
- Automated encrypted backups to S3
- GTID-based replication
- Comprehensive health monitoring
- Zero-config standalone mode
MYSQL_ROOT_PASSWORD
: Root password for MySQLMYSQL_REPL_USERNAME
: Replication user (required for cluster mode)MYSQL_REPL_PASSWORD
: Replication password (required for cluster mode)
S3_ACCESS_KEY
: S3 access keyS3_SECRET_KEY
: S3 secret keyS3_ENDPOINT
: S3 endpoint URLS3_BUCKET
: S3 bucket nameS3_PATH
: Path within bucket for backupsS3_SSL
: Enable SSL for S3 (true/false)
BACKUP_CONFIG_DIR
: Backup configuration directory (default: /etc/mysql/backup)BACKUP_RETENTION_DAYS
: Number of days to retain backupsBACKUP_FULL_INTERVAL
: Interval between full backups in secondsBACKUP_INCR_INTERVAL
: Interval between incremental backups in seconds
CLUSTER_MODE
: Enable cluster mode (default: false)ETCDCTL_ENDPOINTS
: etcd endpoints (required for cluster mode)ETC_USERNAME
: etcd authentication username (optional)ETC_PASSWORD
: etcd authentication password (optional)ETC_PREFIX
: etcd key prefix for all MySQL cluster data (default: /mysql)
The cluster uses etcd for coordination with the following structure:
/mysql/ # Base path for all MySQL cluster data
/nodes/ # Node status and metadata
/topology/ # Cluster topology information
/mysql/nodes/<node_id> # Node status and metadata
{
"status": "online|offline",
"role": "master|slave",
"host": "hostname",
"port": "port",
"last_seen": "timestamp",
"gtid_position": "current_gtid",
"health": {
"status": "string",
"connections": number,
"uptime": number
}
}
/mysql/topology/master # Current master reference
- Each node maintains a lease with TTL
- Health updates occur every 5 seconds
- Node status automatically marked offline when lease expires
- Encrypted backups using AES256
- Full and incremental backup support
- Automatic backup verification
- Streaming backup support via port 4444
- S3-compatible storage support
- Continuous health checks including:
- Process status
- MySQL connectivity
- Read/Write capability
- Replication status
- Automatic failover on master failure
- Error condition monitoring
The system automatically optimizes for:
- Available memory
- CPU cores
- Container limits
- Kubernetes environment detection
- InnoDB settings
- Performance schema (when >8GB RAM available)
MIT License - see LICENSE file for details