The cluster has been three nodes for two years. You’re adding a fourth, in a third availability zone, because the last partition exposed how thin the quorum margin was. The new VM is provisioned, the OS is installed, MariaDB is on the box. You set wsrep_cluster_address to the existing gcomm:// list and start the service — and the joiner pulls down 180 GB over the next 35 minutes while the donor (whichever node Galera picked) runs hot on disk I/O and read queries on it slow down by 3x. Which is recoverable, but if you’d known the difference between SST and IST you might have planned differently. Here is the operational shape of that decision.
What’s happening
When a node joins a Galera cluster it needs to catch up to the rest. Galera offers two paths:
- IST — Incremental State Transfer. The joiner already has a recent enough state on disk that the donor can just stream the missing writesets from the donor’s in-memory ring buffer (
gcache). The donor sends a relatively small delta; the joiner applies it. Fast, no disk pressure, no quoting from a full backup. - SST — State Snapshot Transfer. The joiner has no usable state, or its on-disk state is too old to be in the donor’s gcache. The donor performs a full backup (xtrabackup-v2 or mariabackup) and streams the dataset to the joiner. Slow, donor-disk-heavy, network-intensive.
The deciding factor is whether the joiner’s last-known seqno is still inside the donor’s gcache.size window. gcache is a ring buffer on each node that holds the most recent writesets; default 128M. For a database doing 50 MB/s of writes, 128 MB holds about 2.5 seconds of history — which means anything but a stale joiner falls out of the window and SST becomes mandatory. Increasing gcache.size to 4 GB or 8 GB on a production cluster is one of the highest-leverage tuning changes you can make.
The second decision Galera makes is which node becomes the donor. By default the cluster picks one — sometimes the wrong one, like the node currently serving the most read traffic. You can pin it with wsrep_sst_donor on the joiner.
How to verify
Before triggering a join, check the donor’s gcache state:
SHOW STATUS LIKE 'wsrep_local_cached_downto';
-- Returns the lowest seqno still in this node's gcache
SHOW STATUS LIKE 'wsrep_last_committed';
-- Returns the most recent seqno
The window is wsrep_last_committed minus wsrep_local_cached_downto. If the joiner’s grastate.dat seqno is inside that range, IST is possible. If it is below wsrep_local_cached_downto, SST is mandatory.
Check gcache.size:
mysql -uroot -p -e "SHOW VARIABLES LIKE 'wsrep_provider_options'\G" | grep -i gcache.size
Watch a live SST from the donor:
# On the donor — what stream is going where
ss -ntp | grep -E ':(4444|4568)\b'
# On the joiner — same
journalctl -u mariadb -f | grep -E '(WSREP_SST|IST|SST|Streaming|received)'
The fix
The procedure splits into “preparation” (cluster-side, no service impact) and “join” (joiner-side, donor will be stressed).
Step 1 — Size the gcache before you ever grow the cluster
This is the change that matters most. On each existing node, edit the my.cnf and bump gcache.size:
[mysqld]
wsrep_provider_options = "gcache.size=4G;gcache.page_size=128M;gcache.recover=yes"
Rolling restart, one node at a time, waiting for each to return to Synced before touching the next:
# On db01
systemctl restart mariadb
mysql -uroot -p -e "SHOW STATUS LIKE 'wsrep_local_state_comment';" # wait for Synced
# Then db02 ... db03
A 4 GB gcache on a 50 MB/s write workload holds about 80 seconds of history. That covers any sane planned restart and most unplanned ones.
Step 2 — Pre-stage the joiner without joining
On the new node, install MariaDB (or PXC) following your standard installer, write the same my.cnf, but do not start the service yet:
# Install per your installer (the MariaDB Galera deploy article covers this)
systemctl stop mariadb
Edit /etc/my.cnf.d/galera.cnf on the joiner so it advertises itself correctly and points at the existing cluster:
[mysqld]
wsrep_cluster_name = galera_prod
wsrep_cluster_address = gcomm://10.20.0.11,10.20.0.12,10.20.0.13
wsrep_node_name = db04
wsrep_node_address = 10.20.0.14
wsrep_sst_method = mariabackup
wsrep_sst_auth = sstuser:CHANGE_ME_SST
# Pin the donor to a quiet node — not the one serving the most reads.
wsrep_sst_donor = db03,
# The trailing comma is significant — it tells Galera "prefer db03, but fall back."
wsrep_provider_options = "gcache.size=4G"
Step 3 — Decide SST vs IST
If this is a brand-new node, you have no choice — SST is the only option (nothing to do IST from). If this is a returning node that was down for less than your gcache window, IST will happen automatically. Either way, plan around what the donor will be doing.
For SST, schedule the join during a low-traffic window. The donor’s read latency will rise during the snapshot phase. With mariabackup, the donor stays online and serves read traffic, but disk I/O on the donor doubles for the duration of the backup.
To reduce the impact:
-
Pin the donor (
wsrep_sst_donor=db03,) to a node that’s not currently the active write target in your HAProxy config. -
Temporarily lower the donor’s HAProxy weight to 0 so reads flow to the other two while it’s donating:
# On the HAProxy host echo "set weight galera_read_bk/db03 0" | socat stdio /run/haproxy/admin.sock echo "set weight galera_read_bk/db03 1" | socat stdio /run/haproxy/admin.sock # after SST done
Step 4 — Start the joiner
On db04:
systemctl start mariadb
journalctl -u mariadb -f
What you want to see in the log:
WSREP: gcomm: connecting to group 'galera_prod'— the joiner found the gcomm members.WSREP: New cluster view: ... members = 4, my idx = 3— the joiner is in the membership.- One of:
WSREP_SST: Streaming the backup to joiner at 10.20.0.14:4444(SST is happening on port 4444).WSREP: IST received: <seqno>(IST is happening on port 4568 — much faster).
- Eventually:
WSREP: Member 3.0 (db04) synced with group.
Then verify from any other node:
mysql -uroot -p -e "SHOW STATUS LIKE 'wsrep_cluster_size';"
# 4
mysql -uroot -p -e "SHOW STATUS LIKE 'wsrep_local_state_comment';"
# Synced
Step 5 — Add the new node to the load balancer
Open /etc/haproxy/haproxy.cfg and add the fourth backend:
backend galera_read_bk
balance roundrobin
option httpchk
http-check send meth GET uri /
http-check expect status 200
default-server inter 2s rise 2 fall 2
server db01 10.20.0.11:3306 check port 9200
server db02 10.20.0.12:3306 check port 9200
server db03 10.20.0.13:3306 check port 9200
server db04 10.20.0.14:3306 check port 9200 # new
systemctl reload haproxy
echo "show servers state" | socat stdio /run/haproxy/admin.sock | grep db04
For the write backend, you generally do not add db04 as an active writer. Single-writer routing is part of how you keep certification conflicts low — only one node in balance first order at a time. If you want db04 to be available as a writer-failover candidate, add it with backup:
backend galera_write_bk
balance first
...
server db01 10.20.0.11:3306 check port 9200
server db02 10.20.0.12:3306 check port 9200 backup
server db03 10.20.0.13:3306 check port 9200 backup
server db04 10.20.0.14:3306 check port 9200 backup # new
Step 6 — Sanity checks after the join
wsrep_cluster_size = 4on all four nodes — including the arbitrator if you have one.wsrep_flow_control_paused< 0.05 sustained on all four. If the new node is back-pressuring the cluster, it’s underprovisioned for the write rate; raisewsrep_slave_threadsor move it to a faster disk before you call the operation done.- HAProxy reports
db04as UP on both the read and the write-backup backends. - A manual application connection (
mysql -h haproxy-vip -u app -p) lands on the cluster and SELECTs return current data.
When to avoid this procedure
Two cases:
- Cluster is currently degraded. Don’t grow a cluster that already has a node missing or in
Donor/Desynced. Recover to a healthy 3-node Primary first, then add the fourth. - The new node is in a network that can’t reach the existing gcomm ports (4567 TCP/UDP, 4568 TCP, 4444 TCP). Test connectivity with
nc -zvfrom the joiner to each existing node before bringing the service up — discovering the firewall rule during a half-completed SST is unpleasant.
Stack Harbor handles Galera grow-and-shrink operations under environment management — including planning the window, pre-staging the gcache, pinning the donor, and watching flow control during the join. If you’d rather hand this off, start the conversation.