keepalived双网卡配置实例
时间:2015-01-19 18:23 来源:linux.it.net.cn 作者:IT
环境:
master: eth0:192.168.1.19 eth1:10.10.10.131
backup: eth0:192.168.1.20 eth1:10.10.10.132
vip1:192.168.1.17
vip2:10.10.10.133
1,双网卡单VRRP实例配置
master:
global_defs {
router_id Haweb_1
}
vrrp_sync_group VGM {
group {
VI_HA
}
}
vrrp_instance VI_HA {
state MASTER
interface eth0
lvs_sync_daemon_interface eth0
virtual_router_id 51
priority 100
advert_int 5
authentication {
auth_type PASS
auth_pass 111
}
track_interface {
eth0
eth1
}
virtual_ipaddress {
192.168.1.17/24 dev eth0
10.10.10.133/24 dev eth1
}
}
backp:
global_defs {
router_id Haweb_1
}
vrrp_sync_group VGM {
group {
VI_HA
}
}
vrrp_instance VI_HA {
state BACKUP
interface eth0
lvs_sync_daemon_interface eth0
virtual_router_id 51
priority 99
advert_int 5
authentication {
auth_type PASS
auth_pass 111
}
track_interface {
eth0
eth1
}
virtual_ipaddress {
192.168.1.17/24 dev eth0
10.10.10.133/24 dev eth1
}
}
2,双网卡双VRRP实例配置
master:
global_defs {
router_id Haweb_1
}
vrrp_sync_group VGM {
group {
VI_HA_1
VI_HA_2
}
}
vrrp_instance VI_HA_1 {
state MASTER
interface eth0
lvs_sync_daemon_interface eth0
virtual_router_id 51
priority 100
advert_int 5
authentication {
auth_type PASS
auth_pass 111
}
track_interface {
eth0
eth1
}
virtual_ipaddress {
192.168.1.17/24 dev eth0
}
}
vrrp_instance VI_HA_2 {
state MASTER
interface eth1
lvs_sync_daemon_interface eth1
virtual_router_id 52
priority 100
advert_int 5
authentication {
auth_type PASS
auth_pass 111
}
track_interface {
eth0
eth1
}
virtual_ipaddress {
10.10.10.133/24 dev eth1
}
}
backp:
global_defs {
router_id Haweb_1
}
vrrp_sync_group VGM {
group {
VI_HA_1
VI_HA_2
}
}
vrrp_instance VI_HA_1 {
state BACKUP
interface eth0
lvs_sync_daemon_interface eth0
virtual_router_id 51
priority 99
advert_int 5
authentication {
auth_type PASS
auth_pass 111
}
track_interface {
eth0
eth1
}
virtual_ipaddress {
192.168.1.17/24 dev eth0
}
}
vrrp_instance VI_HA_2 {
state BACKUP
interface eth1
lvs_sync_daemon_interface eth1
virtual_router_id 52
priority 99
advert_int 5
authentication {
auth_type PASS
auth_pass 111
}
track_interface {
eth0
eth1
}
virtual_ipaddress {
10.10.10.133/24 dev eth1
}
}
3,监控http服务,master恢复不抢占配置(双网卡可参考以下配置)
master:
global_defs {
router_id Haweb_1
}
vrrp_sync_group VGM {
group {
VI_HA
}
}
###检查http进程或端口是否异常
vrrp_script chk_http_port {
script "killall -0 httpd"
# script "/tcp/127.0.0.1/80"
interval 1
}
vrrp_instance VI_HA {
state BACKUP ###设为BACKUP恢复后不抢占
interface eth0
lvs_sync_daemon_interface eth0
virtual_router_id 51
priority 100
advert_int 5
nopreempt ###表示不抢占
authentication {
auth_type PASS
auth_pass 111
}
virtual_ipaddress {
192.168.1.17/24 dev eth0
}
###执行以上命令
track_script {
chk_http_port
}
}
backup:
global_defs {
router_id Haweb_1
}
vrrp_sync_group VGM {
group {
VI_HA
}
}
vrrp_script chk_http_port {
script "killall -0 httpd"
# script "/tcp/127.0.0.1/80"
interval 1
}
vrrp_instance VI_HA {
state BACKUP
interface eth0
lvs_sync_daemon_interface eth0
virtual_router_id 51
priority 99
advert_int 5
authentication {
auth_type PASS
auth_pass 111
}
virtual_ipaddress {
192.168.1.17/24 dev eth0
}
track_script {
chk_http_port
}
}
(责任编辑:IT)
环境:
master:
backup: vip1:192.168.1.17 vip2:10.10.10.133
1,双网卡单VRRP实例配置 master: global_defs {
vrrp_sync_group VGM {
}
vrrp_instance VI_HA {
}
backp: global_defs {
vrrp_sync_group VGM {
}
vrrp_instance VI_HA {
}
2,双网卡双VRRP实例配置 master: global_defs {
vrrp_sync_group VGM {
}
vrrp_instance VI_HA_1 {
}
vrrp_instance VI_HA_2 {
}
backp: global_defs {
vrrp_sync_group VGM {
}
vrrp_instance VI_HA_1 {
}
vrrp_instance VI_HA_2 {
}
3,监控http服务,master恢复不抢占配置(双网卡可参考以下配置) master: global_defs {
vrrp_sync_group VGM {
}
###检查http进程或端口是否异常 vrrp_script chk_http_port {
#
}
vrrp_instance VI_HA {
virtual_ipaddress {
###执行以上命令 track_script {
}
backup: global_defs {
vrrp_sync_group VGM {
}
vrrp_script chk_http_port {
#
}
vrrp_instance VI_HA {
virtual_ipaddress {
track_script {
} (责任编辑:IT) |