How to Debug MariaDB Galera

Connect to the DB

Start a shell in one of the Galera cluster Pods and use the mysql client to connect to the DB.

kubectl exec -n $INSTANCE_ID mariadb-2 \
    -it -c mariadb-galera \
    -- bash -c "mysql -uroot --password=\$MARIADB_ROOT_PASSWORD"

When connected to the Galera cluster these SQL commands may be useful to debug what’s wrong: Using Status Variables.

Show MariaDB logs

To see the logs of a single node:

kubectl -n $INSTANCE_ID logs -c mariadb-galera mariadb-0 -f

To see the logs of all nodes:

kubectl -n $INSTANCE_ID logs -c mariadb-galera \
    -l \
    --prefix -f