34 lines
709 B
Plaintext
34 lines
709 B
Plaintext
global_defs {
|
||
router_id nginx1 # 在另一台服务器中,这里配置 nginx2
|
||
script_user root
|
||
enable_script_security
|
||
}
|
||
|
||
vrrp_script chk_nginx {
|
||
script "/sbin/ss -lnt | grep -q ':80\>'"
|
||
interval 10
|
||
weight 0
|
||
fall 2
|
||
rise 2
|
||
}
|
||
|
||
vrrp_instance VI_1 {
|
||
state BACKUP
|
||
virtual_router_id 14
|
||
priority 150 # 在另一台服务器中,这里配置100
|
||
advert_int 2
|
||
nopreempt
|
||
interface eth0 # 这里的 eth0 是服务器的网卡名
|
||
track_script {
|
||
chk_nginx
|
||
}
|
||
authentication {
|
||
auth_type PASS
|
||
auth_pass El_en_nginx_1234
|
||
}
|
||
virtual_ipaddress {
|
||
虚拟IP/掩码 dev eth0 # 这里的eth0是服务器的网卡名
|
||
}
|
||
}
|
||
|