Hello, I'm learning about the application scenarios of keepalived's nopreempt, but I've encountered a problem with the master-slave failover principle.
A conf
`nick@nick-VMware-Virtual-Platform:~$ cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
# 节点状态 MASTER or BACKUP
#state MASTER
# 是否开启抢占 preempt or nopreempt
# 发送协商数据包的网络接口
#interface eth0
# 节点优先级,MASTER设置为100,BACKUP设置为99
#priority 100
state BACKUP
nopreempt
interface ens37
priority 100
unicast_src_ip 192.168.10.101
unicast_peer {
192.168.10.102
}
# 切换延迟时间,保证设备该执行的业务都能结束
garp_master_delay 10
# 虚拟路由器ID,同一组的节点必须相同
virtual_router_id 51
# 发送通告间隔时间,单位为秒
advert_int 1
# 认证方式和密码,用于防止未授权的节点加入同一组
authentication {
auth_type PASS
auth_pass 1111
}
# 监测网口状态
track_interface {
ens38 weight -2
}
# 虚拟IP地址列表,同一组的节点必须相同
virtual_ipaddress {
}
# 虚拟IPv6地址列表
virtual_ipaddress_excluded {
}
# 虚拟路由列表,同一组的节点必须相同
virtual_routes {
}
}`
B conf
nick@nick-VMware-Virtual-Platform:~$ cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
# 节点状态 MASTER or BACKUP
#state MASTER
# 是否开启抢占 preempt or nopreempt
# 发送协商数据包的网络接口
#interface eth0
# 节点优先级,MASTER设置为100,BACKUP设置为99
#priority 100
state BACKUP
nopreempt
interface ens37
priority 99
unicast_src_ip 192.168.10.101
unicast_peer {
192.168.10.102
}
# 切换延迟时间,保证设备该执行的业务都能结束
garp_master_delay 10
# 虚拟路由器ID,同一组的节点必须相同
virtual_router_id 51
# 发送通告间隔时间,单位为秒
advert_int 1
# 认证方式和密码,用于防止未授权的节点加入同一组
authentication {
auth_type PASS
auth_pass 1111
}
# 监测网口状态
track_interface {
ens38 weight -2
}
# 虚拟IP地址列表,同一组的节点必须相同
virtual_ipaddress {
}
# 虚拟IPv6地址列表
virtual_ipaddress_excluded {
}
# 虚拟路由列表,同一组的节点必须相同
virtual_routes {
}
}
First, start device A, then start device B. If you use ip link set ens38 down, the state will not switch. You can also switch if you restart the system or restart keepalived. Is this as expected?
Hello, I'm learning about the application scenarios of keepalived's nopreempt, but I've encountered a problem with the master-slave failover principle.
A conf
`nick@nick-VMware-Virtual-Platform:~$ cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
# 节点状态 MASTER or BACKUP
#state MASTER
# 是否开启抢占 preempt or nopreempt
# 发送协商数据包的网络接口
#interface eth0
# 节点优先级,MASTER设置为100,BACKUP设置为99
#priority 100
state BACKUP
nopreempt
interface ens37
priority 100
unicast_src_ip 192.168.10.101
unicast_peer {
192.168.10.102
}
}`
B conf
nick@nick-VMware-Virtual-Platform:~$ cat /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
# 节点状态 MASTER or BACKUP
#state MASTER
# 是否开启抢占 preempt or nopreempt
# 发送协商数据包的网络接口
#interface eth0
# 节点优先级,MASTER设置为100,BACKUP设置为99
#priority 100
state BACKUP
nopreempt
interface ens37
priority 99
unicast_src_ip 192.168.10.101
unicast_peer {
192.168.10.102
}
}
First, start device A, then start device B. If you use
ip link set ens38 down, the state will not switch. You can also switch if you restart the system or restart keepalived. Is this as expected?