Skip to content

Instantly share code, notes, and snippets.

@lefred
Created February 15, 2018 21:07
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
MySQL InnoDB Cluster Consul check
# script used in consul
# the following addition to sys is required:
# https://gist.github.com/lefred/153448f7ea0341d6d0daa2738db6fcd8
# v.0.1 - lefred 2018-02-14
read -r mysql_primary mysql_readonly mysql_tx mysql_cert <<<$(mysql -h 127.0.0.1 -P 6446 -BNe "select * from sys.gr_member_routing_candidate_status")
if [[ "${mysql_primary}" == "YES" ]] && [[ "${mysql_readonly}" == "NO" ]]
then
echo "MySQL InnoDB Cluster is fine"
exit 0
fi
echo "MySQL InnoDB Cluster is not OK (Primary: ${mysql_primary}, R/O: ${mysql_readonly})"
exit 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment