Configuration
Plan MySQL topology and identity; declare databases, users, parameter overrides, and backup policy.
MySQL is one of the world’s most popular open-source relational databases. Pigsty’s MYSQL module deploys a fixed, native MySQL 8.4 LTS platform on managed nodes: either a standalone instance or a three-node single-primary InnoDB Cluster built on Group Replication, with TLS, backups, monitoring, and lifecycle handled for you.
MYSQL is a supplementary pilot module. It aims to be a simple, inexpensive, good-enough MySQL cluster — not a peer of the PGSQL module. The core capabilities (deployment and convergence, HA failover, daily backups, monitoring and alerting) have been tested systematically; destructive procedures such as complete-outage recovery and physical restore are deliberately kept manual, with runbooks provided in Administration.
The MYSQL module currently provides:
6446) and read-only (6447) endpointsmysql_databases and mysql_users converge additively and never delete data implicitlymysql_parameters overrides for key settings such as max_connections, with orchestrated rolling restarts on configuration changesql_require_primary_key enabled by default, blocking PK-less tables that would break MGR replication and disaster recoverymysql.yml heals the cluster; destructive paths are fenced by guardrailsThe MYSQL module depends on NODE for node management, package repositories, and the shared CA, and on INFRA for VictoriaMetrics, VictoriaLogs, Grafana, and Alertmanager. It does not require ETCD or PGSQL.
flowchart LR
admin["Pigsty admin node"] -->|"mysql.yml"| mysqld["mysqld ×3 / single-primary MGR<br>3306 · TLS"]
client["Application clients"] -->|"RW 6446 / RO 6447"| router["MySQL Router<br>(on every HA member)"]
router --> mysqld
mysqld --> backup["XtraBackup daily full<br>(current primary only)"]
mysqld --> exporter["mysqld_exporter :9104"]
mysqld --> journal["Error log → Journald"]
exporter --> vm["VictoriaMetrics"]
journal --> vector["Vector"] --> vl["VictoriaLogs"]
vm --> grafana["Grafana"]
vl --> grafana
vm --> alertmanager["Alertmanager"]
style mysqld fill:#4479A1,stroke:#33618a,color:#fff
style router fill:#70C1B3,stroke:#4f968b,color:#fff
style vm fill:#E66B7A,stroke:#b84e5c,color:#fff
style vl fill:#C98367,stroke:#9e634e,color:#fffIn the three-node topology, mysql_seq=1 is only the bootstrap coordinator. The runtime PRIMARY is elected, and reruns never force the primary back to node 1.
| Component | Purpose | Fixed endpoint |
|---|---|---|
mysqld | Standalone server or MGR member | Classic 3306, X Protocol 33060 |
| Group Replication | Three-member replication and consensus (XCOM) | 33061 |
| MySQL Router | Topology-aware entry point on every HA member | RW 6446, RO 6447 |
| MySQL Shell | AdminAPI cluster lifecycle | Local control plane |
| XtraBackup | Daily full physical backup | Local backup repository |
mysqld_exporter | Server and MGR metrics | 9104 |
The role creates and manages three platform identities:
dbuser_cluster@'%': TLS-only AdminAPI and Router bootstrap identity (created on HA clusters only);dbuser_monitor@'127.0.0.1': least-privilege exporter identity;dbuser_backup@'localhost': local XtraBackup identity.The native-package platform gate admits:
| Arch | Supported systems |
|---|---|
x86_64 | EL 8/9/10, Debian 12/13, Ubuntu 22/24 |
aarch64 | EL 9/10 |
Debian/Ubuntu ARM64 is rejected at preflight: Oracle’s APT repository publishes no arm64 payload for MySQL 8.4. On ARM, use EL 9/10 (e.g. Rocky Linux).
MYSQL is a fixed platform, not a general-purpose MySQL installer. The following are deliberate non-goals — confirm they are acceptable before adopting:
mysql_parameters| Page | Content |
|---|---|
| Configuration | Topology planning, identity, databases, users, parameter overrides, backup settings |
| Parameters | The 11 public parameters and fixed platform conventions |
| Administration | Status checks, client access, config changes, failure handling, and three recovery runbooks |
| Playbook | mysql.yml and mysql-rm.yml usage, tags, and guardrails |
| Monitoring | Dashboards, recording rules, alert rules, log queries |
| Metrics | Label model and the derived-metric dictionary |
| FAQ | Platform limits, primary-key policy, recovery, troubleshooting |
Declare a cluster in the inventory (full template: conf/demo/mysql.yml):
all:
children:
my-test:
hosts:
10.10.10.11: { mysql_seq: 1 }
10.10.10.12: { mysql_seq: 2 }
10.10.10.13: { mysql_seq: 3 }
vars:
mysql_cluster: my-test
mysql_databases: [ { name: app } ]
mysql_users: [ { name: app, password: DBUser.App, priv: { 'app.*': 'ALL PRIVILEGES' } } ]
vars:
node_repo_modules: node,infra,mysql # repos must include the mysql module
mysql_root_password: MySQL.Root # change all sample passwords in production
mysql_monitor_password: MySQL.Monitor
mysql_cluster_password: MySQL.Cluster
After NODE provisioning, deploy:
./node.yml -l my-test # node provisioning: repo, shared CA, monitoring agents
./mysql.yml -l my-test --check # preflight the complete three-node cluster
./mysql.yml -l my-test # real run; a three-node cluster takes ~2 minutes
mysql -h 10.10.10.11 -P 6446 -u app -pDBUser.App \
--ssl-mode=VERIFY_CA --ssl-ca=/etc/pki/ca.crt app # connect through the Router RW endpoint
Then open the Grafana MySQL Overview dashboard to inspect the cluster.
Plan MySQL topology and identity; declare databases, users, parameter overrides, and backup policy.
The 11 public parameters of the MYSQL module, and its fixed platform conventions.
Status checks, client access, configuration changes, failure handling, and the three recovery runbooks for MySQL clusters.
Deploy, converge, tune, and retire MySQL clusters with mysql.yml and mysql-rm.yml.
MySQL metric collection, Grafana dashboards, alert rules, and log queries.
Label model, derived-metric dictionary, and raw metric families of the MYSQL module.
Frequently asked questions and troubleshooting for the Pigsty MySQL pilot module.
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.