Find Galera seqno/GTID from running node

mariadb-seal-shaded-browntext-galeraGalera’s documentation on restarting an entire cluster instructs you to read the grastate.dat file on each node and check the seqno field to find the most advanced node. However grastate.dat is only written on clean shutdown, so that doesn’t help you if you want to find the seqno for a running cluster.

I found the answer in a google groups post:

MariaDB [(none)]> show status like '%wsrep_last_committed%';
| Variable_name | Value |
| wsrep_last_committed | 16 |
1 row in set (0.01 sec)

If you need to find the seqno for a node that isn’t running but doesn’t have an up to date grastate.dat, then use service mysqld –wsrep-recover, which will cause mysqld to start, write the seqno to the log, then quit.