标签:ble ali val pac virt vim tab router .sh
主: 192.168.39.83vim keepalived.conf
! Configuration File for keepalived
global_defs {
router_id nginx_master
}
vrrp_script chk_nginx {
script "/data/scripts/nginx_check.sh"
interval 2
}
vrrp_instance VI_1 {
state MASTER
interface em1
virtual_router_id 51
priority 101
advert_int 1
track_script {
chk_nginx
}
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.39.20/24
192.168.39.21/24
}
}
vrrp_instance VI_2 {
state BACKUP
interface em1
virtual_router_id 52
priority 99
advert_int 1
track_script {
chk_nginx
}
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.39.10/24
192.168.39.11/24
}
}
从:192.168.39.84
vim keepalived.conf
! Configuration File for keepalived
global_defs {
router_id nginx_backup
}
vrrp_script chk_nginx {
script "/data/scripts/nginx_check.sh"
interval 2
}
vrrp_instance VI_1 {
state BACKUP
interface em1
virtual_router_id 51
priority 99
advert_int 1
track_script {
chk_nginx
}
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.39.20/24
192.168.39.21/24
}
}
vrrp_instance VI_2 {
state MASTER
interface em1
virtual_router_id 52
priority 101
advert_int 1
track_script {
chk_nginx
}
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.39.10/24
192.168.39.11/24
}
}
注: iptables需要开启vrrp协议访问
iptables -I INPUT -p vrrp -j ACCEPT
标签:ble ali val pac virt vim tab router .sh
原文地址:http://blog.51cto.com/haoyonghui/2135854