我们知道,最简单的keepalive vrrp作出来的VIP实例,征用了2台服务器,生成1个VIP,也就是说,基础实配置实例中,我们的业务流量只会流向其中一台服务器,另一台就空闲了,明显示合,
能否做2个VRRP 的VIP,分配生效在2台上呢,答案是可以的。但这个常规的VRRP在 openstack的虚拟机上不能生效,原因是openstack的VM的IP分配唯一上做了严控,如需让OPenstack的VM支持VRRP,需要额外分配和绑定端口给实例上去。
我使用的是物理机,或者传统KVM虚拟机的配置示例。如下,启用2个vrrp实例,并使用2组virtual_router_id即可。原理一致电
kxcontroller1服务器上
! Configuration file for keepalived
global_defs {
notification_email {
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_PRO2
}
vrrp_instance VI_1 {
state MASTER
interface eno4
virtual_router_id 53
mcast_src_ip 10.120.42.2
priority 100
advert_int 1
# nopreempt
authentication {
auth_type PASS
auth_pass chtopnet
}
virtual_ipaddress {
10.120.42.10
}
}
vrrp_instance VI_2 {
state BACKUP
interface eno4
virtual_router_id 54
mcast_src_ip 10.120.42.2
priority 95
advert_int 1
# nopreempt
authentication {
auth_type PASS
auth_pass chtopnet
}
virtual_ipaddress {
10.120.42.110
}
}
kxcontroller2
! Configuration file for keepalived
global_defs {
notification_email {
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_PRO1
}
vrrp_instance VI_1 {
state BACKUP
interface eno4
virtual_router_id 53
mcast_src_ip 10.120.42.1
priority 95
advert_int 1
# nopreempt
authentication {
auth_type PASS
auth_pass chtopnet
}
virtual_ipaddress {
10.120.42.10
}
}
vrrp_instance VI_2 {
state MASTER
interface eno4
virtual_router_id 54
mcast_src_ip 10.120.42.1
priority 100
advert_int 1
# nopreempt
authentication {
auth_type PASS
auth_pass chtopnet
}
virtual_ipaddress {
10.120.42.110
}
}