Cluster
keepalived 2個VIP和2個伺服器
是否可以以這種方式配置keepalived?
正常狀態下 VIP_1 分配給 SERVER_1 和 VIP_2 分配給 SERVER_2
在伺服器故障時,所有 VIP 都將轉到工作伺服器,並且在故障伺服器上線後,我們不會將他的 VIP 遷移回他,由於某些內容複製的原因,我們需要手動進行。
目前的配置:
#SERVER_1 vrrp_sync_group VG1 { group { content } } vrrp_instance content { state BACKUP interface eth1 virtual_router_id 1 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1212 } virtual_ipaddress { 192.168.100.111/24 } } # SERVER_2 vrrp_sync_group VG1 { group { content } } vrrp_instance content { state BACKUP interface eth1 virtual_router_id 1 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1212 } virtual_ipaddress { 192.168.100.111/24 } }
在主機 1 上:
vrrp_instance VI_1 { state MASTER interface eth0 dont_track_primary virtual_router_id 1 priority 150 advert_int 5 mcast_src_ip 172.16.40.1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.1/24 dev eth0 } } vrrp_instance VI_2 { state BACKUP interface eth0 dont_track_primary virtual_router_id 5 priority 100 advert_int 5 mcast_src_ip 172.16.40.1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.2/24 dev eth0 } }
在主機 2 上:
vrrp_instance VI_1 { state BACKUP interface eth0 dont_track_primary virtual_router_id 1 priority 100 advert_int 5 mcast_src_ip 172.16.40.2 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.1/24 dev eth0 } } vrpp_instance VI_2 { state MASTER interface eth0 dont_track_primary virtual_router_id 5 priority 150 advert_int 5 mcast_src_ip 172.16.40.2 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 10.0.0.2/24 dev eth0 } }
對於 no-auto-failback,請查看 keepalived.conf 手冊頁中的 nopreempt,但另請參閱: http ://article.gmane.org/gmane.linux.keepalived.devel/1537%22