keepalived vrrp_script 不起作用
大家好,最近用keepalived配置一個簡單的HA,用vrrp_script來做進程的監控。但是不知道為什麼,把進程kill掉后vrrp_script就是不起作用,而且log里也沒有相關的信息。我在網上查了很久,配置文件應該沒錯。不知道有沒有碰到過和我一樣的情況。我的系統是centos,keepalived版本是1.2.2. 希望各位前輩給指教一下。
keepalived.conf
vrrp_script check_mysqld {
script "killall -0 mysqld"
interval 2
weight 4
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
virtual_ipaddress {
192.168.1.10
}
track_script{
check_mysqld
}
《解決方案》
和我遇到的問題一樣~知道的幫忙下!
vrrp_script以及track_interface不起效!
埠可以監控到問題,但是不會影響到服務!:em27:
《解決方案》
樓上設置應該是
vrrp_script check_mysqld {
script "killall -0 mysqld"
interval 2
weight -4 這裡問題
}
《解決方案》
能否具體一點?謝謝!
《解決方案》
! Configuration File for keepalived
vrrp_script chk_haproxy {
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
weight -10 # 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 -10 # 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 -10 # 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 -10 # if failed, decrease 40 of the priority
fall 1 # require 2 failures for failures
rise 1 # require 1 sucesses for ok
}
global_defs {
notification_email {
xxx.cn
}
notification_email_from sns-keepalive-A@xxx.cn
#smtp_server 127.0.0.1
#smtp_connect_timeout 30
router_id Haproxy-haB
}
vrrp_instance VI_1 {
state BACKUP
nopreempt
garp_master_delay 2
preempt_delay 300
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.0.188
}
track_script{
chk_haproxy
chk_http_port
chk_http
chk_schedown
}
track_interface{
eth0
eth1
}
}
《解決方案》
上面是配置~
我在這裡說明下吧!
我配置了
script{
chk_haproxy
chk_http_port
chk_http
chk_schedown
}
4個模塊加上
track_interface{
eth0
eth1
}
這樣理論上只要我停HA服務或者停任意埠,服務將自動切到另外一台機器上!
但是我關閉HA和任意埠后,無任何反應!
日誌除了有
Aug 2 11:57:43 ha-A Keepalived_healthcheckers: Netlink reflector reports IP 2.2.2.211 removed
Aug 2 11:57:43 ha-A Keepalived_vrrp: Netlink reflector reports IP 2.2.2.211 removed
沒有任何其他反應!
感覺VRRP腳本機制本身沒生效~ 難道和版本有關?
:cry:
《解決方案》
本帖最後由 Iinvincible 於 2011-08-02 15:54 編輯
日誌裡面沒有相關的信息。我也試過最新版本還是有問題。難道是少了包?但make的時候沒有報錯
《解決方案》
不是啊~ 你是weight 4 相當於權重加4,有啥用!
應該是weight -4 減少4
並且你的主從配置是以權重來劃分並且差值不要太大!比如100 M 50S 這個你要減很久:lol:
《解決方案》
我覺得和這個沒有關係
《解決方案》
返回值為真是weight 加4,