美文网首页
keepalived 脑裂监听脚本

keepalived 脑裂监听脚本

作者: SkTj | 来源:发表于2019-02-25 14:14 被阅读13次

    !/bin/bash

    while true
    do
    Master=10.0.0.10
    Backup=10.0.0.11
    Vip=10.0.0.100
    M_num01=/bin/ping -c 2 -W 3 $Master >/dev/null 2>&1 ; echo $?
    B_num01=/bin/ping -c 2 -W 3 $Backup >/dev/null 2>&1 ; echo $?
    if [ "M_num01" -ne 0 -a "B_num01" -ne 0 ];then
    exit 1
    fi
    M_num02=ssh $Master ip add|grep $Vip|wc -l
    B_num02=ssh $Backup ip add|grep $Vip|wc -l

        if [ "$M_num02" -ne 0 -a "$B_num02" -ne 0 ];then
                echo "The server suffered a brain fracture"
        else
                echo "Server normal"
        fi
    

    done

    相关文章

      网友评论

          本文标题:keepalived 脑裂监听脚本

          本文链接:https://www.haomeiwen.com/subject/stfgyqtx.html