- 论坛徽章:
- 0
|
那个强人帮忙看下!
KEEPALIVE自己监控的端口和CHK_HAPROXY都不起效!
关闭端口和HAPROXY 日志没有任何反应,感觉不会减权重一样! 那个帅哥做过了!帮忙解决下
配置如下:
! Configuration File for keepalived
global_defs {
notification_email {
cnseek@gmail.com
}
#notification_email_from sns-lvs@gmail.com
#smtp_server 127.0.0.1
#smtp_connect_timeout 30
router_id Haproxy-haB
}
vrrp_script chk_haproxy {
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
weight -40 # default prio: -2 if connect fails
fall 3 # require 2 failures for failures
rise 1 # require 1 sucesses for ok
}
vrrp_script chk_http_port {
script "/tcp/127.0.0.1/80" # connects and exits
interval 1 # check every 1 second
weight -40 # default prio: -2 if connect fails
fall 3 # require 2 failures for failures
rise 1 # require 1 sucesses for ok
}
vrrp_script chk_http {
script "/etc/keepalived/check_http.sh" # connects and exits
interval 1 # check every 1 second
weight -40 # default prio: -2 if connect fails
fall 3 # require 2 failures for failures
rise 1 # require 1 sucesses for ok
}
vrrp_script chk_schedown {
script "if [ -f /var/run/down ]; then exit 1; else exit 0; fi"
interval 1 # check every 10 seconds
weight -40 # if failed, decrease 40 of the priority
fall 1 # require 2 failures for failures
rise 1 # require 1 sucesses for ok
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
garp_master_delay 2
#preempt_delay 300
virtual_router_id 51
priority 99
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.0.188
}
track_script{
chk_haproxy weight -40
chk_http_port weight -40
chk_http weight -40
chk_schedown weight -40
}
track_interface {
eth0 weight -40
eth1 weight -40
}
}
~ |
|