keepalived 非抢占模式 以及nginx状态监控
admin
2023-03-23 00:00:48
0
global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id f6
   vrrp_mcast_group4 224.0.0.20
   nopreempt
}
vrrp_script chk_nginx {
#    script "killall -0 nginx"
    script "/etc/keepalived/check_nginx.sh"
    interval 2
    weight -5
    fall 3  
    rise 2
}

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 58
    priority 150
    advert_int 1
    nopreempt
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
     172.21.10.199/24 dev eth0 label eth0:1
 }
     track_script {
       chk_nginx
    }

}


[root@e7 ~]# cat  /etc/keepalived/keepalived.conf 
! Configuration File for keepalived

global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id e7
   vrrp_mcast_group4 224.0.0.20
}
vrrp_script chk_nginx {
#    script "killall -0 nginx"
    script "/etc/keepalived/check_nginx.sh"
    interval 2
    weight -5
    fall 3  
    rise 2
}
vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 58
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
   172.21.10.199/24 dev eth0 label eth0:1
    }
       track_script {
      chk_nginx
    }

}
[root@e7 ~]#
[root@e7 ~]# cat  /etc/keepalived/check_nginx.sh 
#!/bin/bash
counter=$(ps -C nginx --no-heading|wc -l)
if [ "${counter}" = "0" ]; then
    /usr/sbin/nginx
    echo "nginx 1 start"
    sleep 2
    counter=$(ps -C nginx --no-heading|wc -l)
    if [ "${counter}" = "0" ]; then
        echo "keepalived stop"
#        /etc/init.d/keepalived stop
systemctl stop keepalived
    fi
fi


[root@e7 ~]#


相关内容

热门资讯

终于懂了“暗宝真的有挂吗?”(... 终于懂了“暗宝真的有挂吗?”(详细开挂教程)您好,暗宝这个游戏其实有挂的,确实是有挂的,需要了解加客...
今日重大通报“k3k吴江麻将怎... 网上科普关于“k3k吴江麻将有没有挂”话题很是火热,小编也是针对k3k吴江麻将作*弊开挂的方法以及开...
最新引进“天府棋牌怎么开挂?”... 有 亲,根据资深记者爆料天府棋牌是可以开挂的,确实有挂(咨询软件无需打开...
终于了解“毛豆炸/金/花真的有... 网上科普关于“毛豆炸/金/花有没有挂”话题很是火热,小编也是针对毛豆炸/金/花作*弊开挂的方法以及开...
今日重大发现“万圣节消除大作战... 网上科普关于“万圣节消除大作战有没有挂”话题很是火热,小编也是针对万圣节消除大作战作*弊开挂的方法以...
今日重磅消息“鸿运会十三张开挂... 网上科普关于“鸿运会十三张有没有挂”话题很是火热,小编也是针对鸿运会十三张作*弊开挂的方法以及开挂对...
【第一消息】“皇豪众娱牛牛怎么... 您好:皇豪众娱牛牛这款游戏可以开挂,确实是有挂的,需要了解加客服微信【4282891】很多玩家在这款...
游族网络傅焜:人工智能正在驱动... 游族网络首席战略官傅焜发表演讲 人民网上海12月25日电 12月25日,第七届人民网内容科技论坛在上...
【今日要闻】“决战血流麻将怎么... 家人们!今天小编来为大家解答决战血流麻将透视挂怎么安装这个问题咨询软件客服徽9752949的挂在哪里...
【第一财经】“新版九哥牛牛可以... 网上科普关于“新版九哥牛牛有没有挂”话题很是火热,小编也是针对新版九哥牛牛作*弊开挂的方法以及开挂对...