環境說明演示vip自動漂移 192.168.237.50 192.168.237.51 vip: 192.168.237.5 keepalived開源軟體實現 keepalived可以實現當vip掛的時候,自動漂移,基於vrrp虛擬路由冗餘協議 主備,vrrp去宣告 存在問題 主起來後又會接管vip ...
環境說明演示vip自動漂移
192.168.237.50
192.168.237.51
vip: 192.168.237.5
keepalived開源軟體實現
keepalived可以實現當vip掛的時候,自動漂移,基於vrrp虛擬路由冗餘協議
主備,vrrp去宣告
keepalived主伺服器的配置/usr/local/keepalived/etc/keepalived/keepalived.conf
vrrp_instance VI_1 {
state MASTER
interface ens33
virtual_router_id 51
priority 100
advert_int 2
authentication {
auth_type PASS
auth_pass 666666
}
virtual_ipaddress {
192.168.237.5/24
}
}
vrrp_instance配置,配置vip
state 配置主或者備
interface 配置vip使用的物理網卡
virtual_router_id 虛擬路由id
priority 權重配置,主的權重比備的高
advert_int 主每2s發個vrrp包,說明自己正常
authentication 認證信息
virtual_ipaddress 配置vip
檢查配置,啟動keepalived
/usr/local/keepalived/sbin/keepalived -t -f /usr/local/keepalived/etc/keepalived/keepalived.conf
/usr/local/keepalived/sbin/keepalived -f /usr/local/keepalived/etc/keepalived/keepalived.conf
keepalived備伺服器的配置/usr/local/keepalived/etc/keepalived/keepalived.conf
vrrp_instance VI_1 {
state BACKUP
interface ens33
virtual_router_id 51
priority 99
advert_int 2
authentication {
auth_type PASS
auth_pass 666666
}
virtual_ipaddress {
192.168.237.5/24
}
}
抓包可以看到vrrp協議
驗證keepalived的vip自動漂移
存在問題
主起來後又會接管vip
vip的頻繁漂移對於我們不太有利