-
-
Save kevinclcn/55f32499a69cc96480e90eafc810e9ec to your computer and use it in GitHub Desktop.
MySQL InnoDB Cluster Consul check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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