
This commit remove duplicate mysql_password param. And standardize mysql_password (renamed to mysql_root_password), and clarify mysql_sys_maint param (renamed to mysql_sys_maint_password), a new param is now added (mysql_sys_maint_user). This commit also add a bind option to xinetd configuration file. (The default value is setup to ::ipaddress). And cleanup cluster configs to avoid namespaces collisions with corosync cluster. Update of params.pp is managed in openstack-puppet-ci.git
39 lines
1.4 KiB
Plaintext
39 lines
1.4 KiB
Plaintext
#!/bin/bash
|
|
# Managed by puppet
|
|
# Module cloud
|
|
#
|
|
# Script to make a proxy (ie HAProxy) capable of monitoring Percona XtraDB Cluster nodes properly
|
|
#
|
|
# Author: Olaf van Zandwijk olaf.vanzandwijk@nedap.com
|
|
# Documentation and download: https://github.com/olafz/percona-clustercheck
|
|
#
|
|
# Based on the original script from Unai Rodriguez
|
|
#
|
|
|
|
MYSQL_USERNAME="<%= @galera_clustercheck_dbuser %>"
|
|
MYSQL_PASSWORD="<%= @galera_clustercheck_dbpassword %>"
|
|
ERR_FILE="/dev/null"
|
|
AVAILABLE_WHEN_DONOR=0
|
|
|
|
#
|
|
# Perform the query to check the wsrep_local_state
|
|
#
|
|
WSREP_STATUS=`mysql --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} -e "SHOW STATUS LIKE 'wsrep_local_state';" 2>${ERR_FILE} | awk '{if (NR!=1){print $2}}' 2>${ERR_FILE}`
|
|
|
|
if [[ "${WSREP_STATUS}" == "4" ]] || [[ "${WSREP_STATUS}" == "2" && ${AVAILABLE_WHEN_DONOR} == 1 ]]
|
|
then
|
|
# Percona XtraDB Cluster node local state is 'Synced' == return HTTP 200
|
|
/bin/echo -en "HTTP/1.1 200 OK\r\n"
|
|
/bin/echo -en "Content-Type: text/plain\r\n"
|
|
/bin/echo -en "\r\n"
|
|
/bin/echo -en "Mariadb Cluster Node is synced.\r\n"
|
|
/bin/echo -en "\r\n"
|
|
else
|
|
# Percona XtraDB Cluster node local state is not 'Synced' == return HTTP 503
|
|
/bin/echo -en "HTTP/1.1 503 Service Unavailable\r\n"
|
|
/bin/echo -en "Content-Type: text/plain\r\n"
|
|
/bin/echo -en "\r\n"
|
|
/bin/echo -en "Mariadb Cluster Node is not synced.\r\n"
|
|
/bin/echo -en "\r\n"
|
|
fi
|