您的位置:首页 > 其它

keepalived vrrp_script的一些实例配置

2015-03-09 12:04 369 查看
转自:http://www.lvtao.net/tool/keepalived-vrrp_script.html
vrrp_script chk_sshd {
script "killall -0 sshd"    # cheaper than pidof
interval 2         # check every 2 seconds
weight -4        # default prio: -4 if KO
}

vrrp_script chk_haproxy {
script "killall -0 haproxy"    # cheaper than pidof
interval 2        # check every 2 seconds
}

vrrp_script chk_http_port {
script "</dev/tcp/127.0.0.1/80"    # connects and exits
interval 1        # check every second
weight -2        # default prio: -2 if connect fails
}

vrrp_script chk_https_port {
script "</dev/tcp/127.0.0.1/443"
interval 1
weight -2
}

vrrp_script chk_smtp_port {
script "</dev/tcp/127.0.0.1/25"
interval 1
weight -2
}

vrrp_instance VI_1 {
interface eth0
state MASTER
virtual_router_id 51
priority 100

virtual_ipaddress {
192.168.200.18/25
}

track_interface {
eth1 weight 2      # prio = +2 if UP
eth2 weight -2      # prio = -2 if DOWN
eth3        # no weight, fault if down
}

track_script {
chk_sshd       # use default weight from the script
chk_haproxy weight 2    # +2 if process is present
chk_http_port
chk_https_port
chk_smtp_port
}
}

vrrp_instance VI_2 {
interface eth1
state MASTER
virtual_router_id 52
priority 100

virtual_ipaddress {
192.168.201.18/26
}

track_interface {
eth0 weight 2      # prio = +2 if UP
eth2 weight -2      # prio = -2 if DOWN
eth3        # no weight, fault if down
}

track_script {
chk_haproxy weight 2
chk_http_port
chk_https_port
chk_smtp_port
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: