haproxy停掉后,keepalived主备没有切换

在haproxy停掉后,主备机没有切换,keepalived配置如下:

! Configuration File for keepalived

global_defs {
   notification_email {
     [email protected] 
   }
   notification_email_from 123@139.com 
   smtp_server 127.0.0.1
   smtp_connect_timeout 3
   router_id LVS_DEVEL
}
vrrp_script chk_haproxy {
    script "killall -0 haproxy"
    interval 2
    weight 2
}
vrrp_instance VI_1 {
    state MASTER  
    interface eth1 
    virtual_router_id 133
    priority 101
    garp_master_delay 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
     track_interface {
       eth0
       eth1 
       eth2
    }

    virtual_ipaddress {
        172.10.10.15/24
    }
    track_script {
        chk_haproxy
    }
}

其中script “killall -0 haproxy”参数是检测haproxy的运行状态,当haproxy停掉后主备不切换是因为虚拟机最小化镜像安装,没有killall命令
可以通过下面指令进行安装

yum -y install psmisc

你可能感兴趣的:(linux)