Detection ideas: Under normal circumstances keepalived VIP address is on the master node, if the VIP found in the node, set alarm information
The script is as follows:
#!/bin/bash# a script to check for brain fissures and deploy them on the standby node lb01_vip=10.10.10.229lb01_ip=10.10.10.129lb02_ip=10.10.10.130while truedo ping -c 2 -w 3 $LB 01_vip &>/dev/null if [ $? -eq 0 -a ' ip add|grep ' $LB 01_vip "|wc -l ' -eq 1 ];then echo "Ha is brain." else echo "Ha is ok" fi sleep 5done execution results are as follows:[[email protected] mysqlbackup]# bash check_split_brain.sh ha is okha is okha is Okha is ok execution results When an exception is found: [[Email protected] mysqlbackup]# bash check_split_ Brain.sh ha is okha is okha is okha is okha is brain.ha is brain.
Description: This script can be combined with the monitoring platform (e.g. Zabbix, Nagios, etc.)
This article is from the "Frozen vs watermelon" blog, so be sure to keep this source http://molewan.blog.51cto.com/287340/1880210
Script to detect keepalived brain fissure