kolla/docker/mariadb/mariadb-server/healthcheck_mariadb
LinPeiWen 407d774ffb Modify healthcheck_mariadb
Use the healthcheck_mariadb script to check the status of mariadb
Related patch of kolla-ansible:
  https://review.opendev.org/c/openstack/kolla-ansible/+/780404

Change-Id: I9e8fb8fab1adba03aba4ed9ce42e4d4666bc764b
2021-04-26 15:08:30 +00:00

20 lines
446 B
Bash
Executable File

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