blueprint container-health-check Now docker supports healthcheck directive[0] in Dockerfile, which is helpful for checking container aliveness. Base for this patch were healthcheck scripts from tripleo[1]. [0] https://docs.docker.com/engine/reference/builder/#healthcheck [1] https://github.com/openstack/tripleo-common/tree/master/healthcheck Change-Id: Ifc32713cd4d6b45c74855c0ebf5bb65784701d44
18 lines
420 B
Bash
Executable File
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
|