24模拟keepalved vrrp功能,监听主节点,如果主节点不可访问则备节点启动并配置LVS实现接管主节点的资源提供服务(提醒:注意ARP缓存)

[root@lb04 scripts]# cat ha_lv.sh 
#!/bin/bash
while true
    do
    check_count=$(nmap 10.0.0.13|grep "Host is up"|wc -l)
    
    if [ ${check_count} -ne 1 ]
    then
        sh /server/scripts/lv_manager.sh start        
        echo "切换服务器到16从服务器"
            arping -I eth0 -c 1 -U 10.0.0.13
        sleep 1
        get_ip=$(ip  a|grep "10.0.0.13/24"|wc -l)
    
        [ ${get_ip} -eq 1 ] && echo "切换成功"
    fi
    
    sleep 3
done

 

posted @ 2017-12-08 21:56  滴滴滴  阅读(425)  评论(0编辑  收藏  举报