keepalived vrrp_script的一些实例配置

简介:
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
 }
}









本文转自 yntmdr 51CTO博客,原文链接:http://blog.51cto.com/yntmdr/1618521,如需转载请自行联系原作者
目录
相关文章
|
移动开发 网络协议 Shell
LVS+KEEPALIVED 安装与配置实例
--------------------------------------master--------------------------------------- echo "1" > /proc/sys/net/ipv4/ip_forward wget http://www.
1270 0
|
网络协议
KEEPALIVED 做LVS+HA实例安装与配置
--------------------------------------master------------------------------------------------------- wget http://www.
1013 0
KEEPALIVED 做HA实例的安装与配置
--------------------------------------master------------------------------------------------------- wget http://www.
902 0
|
网络协议 应用服务中间件 nginx

热门文章

最新文章