The database behind my WordPress sites runs on a small MariaDB Galera cluster. When something feels slow or a node just rebooted, this is the one query I run on each node.
The query
sudo mariadb -e "SHOW GLOBAL STATUS WHERE Variable_name IN (
'wsrep_cluster_size','wsrep_cluster_status','wsrep_local_state_comment',
'wsrep_ready','wsrep_connected','wsrep_cluster_state_uuid',
'wsrep_flow_control_paused','wsrep_local_recv_queue_avg');"
What healthy looks like
wsrep_cluster_size: the number of nodes you expect.wsrep_cluster_status:Primary. Anything else means that node has lost quorum and won’t take writes.wsrep_local_state_comment:Synced.JoiningorDonor/Desyncedmeans it’s still catching up or feeding another node.wsrep_readyandwsrep_connected: bothON.wsrep_cluster_state_uuid: identical on every node.wsrep_flow_control_pausedandwsrep_local_recv_queue_avg: close to 0. If they climb, a slow node is holding everybody back.
Check every node at once with Ansible
ansible dbservers -b -m shell -a \
"mariadb -N -e \"SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'\""
A note on two-node clusters
With only two nodes, if the link between them drops, neither side has a majority, so both can stop taking writes. A Galera Arbitrator (garbd) on a third small box gives you a tie-breaking vote without a third copy of the data. The full list of status variables is in MariaDB’s docs, and Galera’s monitoring guide explains each one.
God Bless, and Use the Source!