kolla/docker/mariadb/mariadb-server/healthcheck_mariadb
Michal Nasiadka 59616d4423 Add mariadb_clustercheck image
Add mariadb_clustercheck image with xinetd and clustercheck binary for haproxy
checking of galera status.
Reorganise existing mariadb images by creating mariadb-base and mariadb-server.

Existing mariadb image will be deprecated (in a separate change).

Change-Id: Ib601f64e1514521154beeaac40f0c058a7119408
2020-04-22 08:46:33 +00:00

18 lines
420 B
Bash
Executable File

#!/bin/bash
MYSQL_USERNAME="${MYSQL_USERNAME:=-haproxy}"
MYSQL_TIMEOUT=10
MYSQL_CMDLINE="mysql -nNE --connect-timeout=${MYSQL_TIMEOUT} -u ${MYSQL_USERNAME}"
WSREP_STATUS=$($MYSQL_CMDLINE -e "SHOW STATUS LIKE 'wsrep_local_state_comment';")
if [[ "${WSREP_STATUS}" == "Synced" ]]
then
echo "MariaDB Galera Cluster Node is synced."
exit 0
else
echo "MariaDB Galera Cluster Node is NOT synced"
exit 0
fi