负载均衡实现故障vip自动漂移
程序员文章站
2022-11-15 11:22:34
环境说明演示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的频繁漂移对于我们不太有利
上一篇: 很好吃的面粉蒸素菜,一旦吃了就会上瘾
下一篇: 哈密瓜糖分高吗?可以多吃吗?