mariadb-impl-galera-cluster
Installation
SKILL.md
MariaDB Galera Cluster
Galera is a synchronous multi-master cluster built on certification-based replication. Every node can serve reads and writes, write-sets are replicated to every other node, and conflicts are detected at COMMIT time. This skill covers cluster sizing, bootstrap and join procedures, SST method choice, weighted quorum, monitoring, and the application-side retry strategy that Galera REQUIRES.
Quick Reference
- ALWAYS run a minimum of 3 nodes. A 2-node cluster cannot form a stable quorum and either goes read-only on any partition or splits brains when each node assumes the other is dead.
- ALWAYS use
mariabackupas the SST method on production clusters.rsyncblocks the donor with a read lock andmysqldumpis logical, slow, and also blocks the donor. - ALWAYS keep every node on the SAME MariaDB minor version. Heterogeneous clusters cause replication mismatch and SST-stream incompatibility.
- ALWAYS retry transactions on
ER_LOCK_DEADLOCK(error 1213). Galera reports certification failures as deadlocks AT COMMIT TIME, even when the local node never touched a conflicting row. - ALWAYS set
binlog_format=ROW,default_storage_engine=InnoDB, andinnodb_autoinc_lock_mode=2on every node. Galera does not supportSTATEMENTformat or non-InnoDB tables. - ALWAYS use 3+ nodes OR add a
garbdarbitrator (zero-data quorum-vote node) when running an even-numbered cluster across two data-centres. - ALWAYS bootstrap the FIRST node with
galera_new_cluster(ormariadbd --wsrep-new-cluster). Subsequent nodes start normally withwsrep_cluster_address=gcomm://node1,node2,node3. - NEVER point application writes at multiple Galera nodes for the same hot row. Concurrent updates to one row from many nodes cause a cert-failure storm and roll back at COMMIT on every node but one.
- NEVER run
mysqldumpSST in production. Donor is locked for the entire dump duration ; on multi-GB schemas this is hours. - NEVER scale reads by reading from every Galera node mid-SST. The donor lags during the transfer and serves stale data.
- NEVER use a 2-node cluster without
pc.weightweighted quorum or agarbdarbitrator. There is no safe partition outcome. - For read-scaling : add an ASYNC replica off ONE Galera node using standard primary-replica replication, not from every Galera node.