There are some basic steps that can be done to check the health status of a MariaDB/Mysql cluster.

First we can see how many nodes are connected to the cluster. This can be achieved by running the following from the mysql cli:
SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';
The output will give the number of nodes in the cluster. Example:

MariaDB [(none)]> SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| wsrep_cluster_size | 3     |
+--------------------+-------+
1 row in set (0.001 sec)

To check if the node where we are logged in is in sync with the cluster, we can use SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
This will show the current status of the node. Example:

MariaDB [(none)]> SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
+---------------------------+--------+
| Variable_name             | Value  |
+---------------------------+--------+
| wsrep_local_state_comment | Synced |
+---------------------------+--------+
1 row in set (0.002 sec)

In case we are looking for more information related with the cluster, we can run show status like '%wsrep%';

This will provide us with a list of variables related with the cluster.

Leave a Reply

Your email address will not be published. Required fields are marked *