Skip to content

Instantly share code, notes, and snippets.

@lefred
Created February 15, 2018 21:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lefred/22bd7390ae3e23b9335fdeaf1cb72b31 to your computer and use it in GitHub Desktop.
Save lefred/22bd7390ae3e23b9335fdeaf1cb72b31 to your computer and use it in GitHub Desktop.
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