Nginx+Keepalive高可用之主从配置
! Configuration File for keepalivedglobal_defs {
router_id NodeA #路由器标识,最好写主机名,用于标识
}
vrrp_script chk_nginx {
#配置检查方式,chk_nginx为自定义名称
script "/etc/keepalived/nginx_check.sh"
interval 2
weight 20 #此值需要大于MASTER的priority减去BACKUP的priority
}
vrrp_instance VI_1 {
state MASTER #主节点为:MASTER,备节点为:BACKUP
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
#此为认证方式,MASTER和BACKUP统一
auth_type PASS
auth_pass 1314
}
track_script {
#调用上面的检查脚本
chk_nginx
}
virtual_ipaddress {
#设定VIP地址
18.50.129.74/24
}
}
页:
[1]