MariaDB Galera Cluster is a synchronous multi-primary cluster for MariaDB/MySQL that provides true high availability with no single point of failure. Unlike standard primary-replica replication where only one node accepts writes and replicas are read-only, Galera Cluster allows writes to any node simultaneously — all nodes are always primary, always in sync, and always up-to-date. A transaction committed on any node is simultaneously certified and applied on all nodes before the commit returns success. If a node fails, the cluster continues operating with the remaining nodes; the failed node automatically re-syncs (via SST — State Snapshot Transfer) when it rejoins. Galera is the technology behind PlanetScale, Vitess, and many cloud database products. This guide sets up a 3-node MariaDB Galera Cluster on RHEL 9.
Prerequisites
- Three RHEL 9 servers with MariaDB installed
- Node 1:
10.0.1.10, Node 2:10.0.1.11, Node 3:10.0.1.12 - All nodes can reach each other on ports 3306, 4444, 4567, 4568
Step 1 — Install MariaDB with Galera on All Nodes
# On all three nodes
curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version="mariadb-10.11"
dnf install -y MariaDB-server MariaDB-client galera-4
systemctl stop mariadb # Will be configured before starting
Step 2 — Configure Galera on All Nodes
# /etc/mysql/conf.d/galera.cnf — apply on ALL nodes
# Change wsrep_node_address and wsrep_node_name per node
[mysqld]
binlog_format = ROW
default-storage-engine = innodb
innodb_autoinc_lock_mode = 2
bind-address = 0.0.0.0
# Galera provider
wsrep_on = ON
wsrep_provider = /usr/lib64/galera-4/libgalera_smm.so
# Cluster configuration
wsrep_cluster_name = "galera_cluster"
wsrep_cluster_address = "gcomm://10.0.1.10,10.0.1.11,10.0.1.12"
# Node-specific settings (change per node)
wsrep_node_address = "10.0.1.10"
wsrep_node_name = "node1"
# SST method (full re-sync for new/rejoining nodes)
wsrep_sst_method = rsync
Step 3 — Open Required Firewall Ports
# On all three nodes
firewall-cmd --permanent --add-port=3306/tcp # MySQL
firewall-cmd --permanent --add-port=4444/tcp # SST (State Snapshot Transfer)
firewall-cmd --permanent --add-port=4567/tcp # Galera replication
firewall-cmd --permanent --add-port=4567/udp
firewall-cmd --permanent --add-port=4568/tcp # IST (Incremental State Transfer)
firewall-cmd --reload
Step 4 — Bootstrap the First Node
# ONLY on Node 1 (10.0.1.10) — bootstrapping creates a new cluster
galera_new_cluster
systemctl status mariadb
# Verify the cluster has 1 member
mysql -u root -e "SHOW STATUS LIKE 'wsrep_cluster_size';"
Step 5 — Join Nodes 2 and 3
# On Node 2 and Node 3 (use normal start, not galera_new_cluster)
systemctl start mariadb
# From any node — cluster size should now be 3
mysql -u root -e "SHOW STATUS LIKE 'wsrep_%';" | grep -E "cluster_size|cluster_status|ready|connected"
Step 6 — Test Multi-Primary Writes
# On Node 1: create a table
mysql -u root -e "CREATE DATABASE galtest; CREATE TABLE galtest.t1 (id INT, val VARCHAR(50)); INSERT INTO galtest.t1 VALUES (1,'from-node1');"
# On Node 2: write and read
mysql -u root -e "INSERT INTO galtest.t1 VALUES (2,'from-node2'); SELECT * FROM galtest.t1;"
Conclusion
MariaDB Galera Cluster on RHEL 9 provides synchronous multi-primary replication where every node is always writable and up-to-date. The 3-node minimum allows one node to fail while the cluster remains operational with quorum. For application connectivity, use HAProxy or a Galera-aware load balancer to distribute writes across nodes and route reads to all nodes for maximum utilisation.
Next steps: How to Configure HAProxy for Load Balancing on RHEL 9, How to Configure MySQL Primary-Replica Replication on RHEL 9, and How to Install MariaDB on RHEL 9.