Keepalived之vrrp_script方式检测(mycat)

keepalived
! Configuration File for keepalived

vrrp_script chk_mc {
    script "/usr/local/keepalived/scripts/mc_ha.sh"
    interval 2
}

global_defs {
   router_id k_mc
}

vrrp_instance VI_1 {
    state BACKUP
    interface ens160
    virtual_router_id 77
    priority 100
    advert_int 1
    nopreempt
    authentication {
        auth_type PASS
        auth_pass 1111
    }

    track_script {
        chk_mc
    }

    virtual_ipaddress {
        192.168.1.10
    }
}

mc_ha.sh
#!/bin/bash
mycatcheck=\`ps aux | grep mycat | grep -v grep -c\`
if [ \$mycatcheck -eq 0 ];then
       pkill keepalived
       echo "keepalived is stoped"
fi


你可能感兴趣的:(Keepalived之vrrp_script方式检测(mycat))