标签:ns3 vip bin 信息 负载 路由 pad 负载均衡 环境
环境说明演示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的频繁漂移对于我们不太有利
标签:ns3 vip bin 信息 负载 路由 pad 负载均衡 环境
原文地址:https://www.cnblogs.com/dhzg/p/11274547.html