I am using Keepalived v1.2.23 on RHEL 6.10
I have two servers.
Server1 Configuration:
vrrp_script check_database {
script "my_script"
interval 1
timeout 30
}
vrrp_instance VI_1 {
debug 2
interface eth0.460
state BACKUP
nopreempt
virtual_router_id 51
priority 101
unicast_src_ip 192.168.54.4
unicast_peer {
192.168.54.5
}
track_script {
check_database
}
}
Server2 Configuration:
vrrp_script check_database {
script "my_script"
interval 1
timeout 30
}
vrrp_instance VI_1 {
debug 2
interface eth0.460
state BACKUP
nopreempt
virtual_router_id 51
priority 100
unicast_src_ip 192.168.54.5
unicast_peer {
192.168.54.4
}
track_script {
check_database
}
}
Normally, everything ok, when the servers have encountered any problem, Keepalived triggers failover. But there is a problem in one scenario. When i use "ifdown and ifup" command in my interface tests, i don't understand the behavior of Keepalived.
1. TEST1
- The initial states like following:
Server1: MASTER
Server2: BACKUP
- We assume that the interface "eth0.460" crashes on Server2.
Server1: MASTER
Server2: FAULT
Keepalived_vrrp[8687]: Netlink reflector reports IP 192.168.54.5 removed
Keepalived_healthcheckers[8687]: Netlink reflector reports IP 192.168.54.5 removed
ntpd[1951]: Deleting interface #469 eth0.460, 192.168.54.5#123, interface stats: received=0, sent=0, dropped=0, active_time=14594 secs
Keepalived_vrrp[8687]: Kernel is reporting: interface eth0.460 DOWN
Keepalived_vrrp[8687]: Kernel is reporting: interface eth0.460 DOWN
Keepalived_vrrp[8687]: VRRP_Instance(VI_1) Now in FAULT state
- When the problem is fixed, there is two different behavior. Why the
Server2 want to be MASTER?
First Behavior of Server2 - Expected
Keepalived_vrrp[8687]: Kernel is reporting: interface eth0.460 UP
Keepalived_vrrp[8687]: Kernel is reporting: tracked interface are UP
Keepalived_vrrp[8687]: VRRP_Instance(VI_1): Entering BACKUP STATE
Keepalived_vrrp[8687]: Netlink reflector reports IP 192.168.54.5 added.
Keepalived_healthcheckers[8686]: Netlink reflector reports IP 192.168.54.5 added.
Second Behavior of Server2 - Unexpected
Keepalived_vrrp[31531]: Kernel is reporting: interface eth0.460 UP
Keepalived_vrrp[31531]: VRRP_Instance(VI_1): Entering BACKUP STATE
Keepalived_vrrp[31531]: Netlink reflector reports IP 192.168.54.5 added
Keepalived_healthcheckers[31529]: Netlink reflector reports 192.168.54.5 added
Keepalived_vrrp[31531]: VRRP_Instance(VI_1) **Transition to MASTER STATE**
Keepalived_vrrp[31531]: VRRP_Instance(VI_1) **Received higher prio advert 101**
Keepalived_vrrp[31531]: VRRP_Instance(VI_1) Entering BACKUP STATE
2. TEST2
- The initial states like following:
Server1: BACKUP
Server2: MASTER
- We assume that the interface "eth0.460" crashes on Server1.
Server1: FAULT
Keepalived_healthcheckers[9898]: Netlink reflector reports IP 192.168.54.4 removed
Keepalived_vrrp[9899]: Netlink reflector reports IP 192.168.54.4 removed
ntpd[1954]: Deleting interface #109 eth0.460, 192.168.54.4#123, interface stats: received=0, sent=0, dropped=0, active_time=79741 secs
Keepalived_vrrp[9899]: Kernel is reporting: interface eth0.460 DOWN
Keepalived_vrrp[9899]: VRRP_Instance(VI_1) Now in FAULT state
Server2: MASTER
- When the problem is fixed, there is two different behavior. Why does Server1 become MASTER when Server2 is MASTER?
First Behavior of Server1 - Expected
Keepalived_vrrp[9899]: Kernel is reporting: interface eth0.460 UP
Keepalived_vrrp[9899]: VRRP_Instance(VI_1): Entering BACKUP STATE
Keepalived_healthcheckers[9898]: Netlink reflector reports IP 192.168.54.4 added
Keepalived_vrrp[9899]: Netlink reflector reports IP 192.168.54.4 added
ntpd[1954]: Listen normally on 115 eth0.460 192.168.54.4 UDP 123
Second Behavior of Server1 - Unexpected
Keepalived_vrrp[25026]: Kernel is reporting: interface eth0.460 UP
Keepalived_vrrp[25026]: VRRP_Instance(VI_1): Entering BACKUP STATE
Keepalived_vrrp[25026]: Netlink reflector reports IP 192.168.54.4 added
Keepalived_healthcheckers[25025]: Netlink reflector reports IP 192.168.54.4 added
Keepalived_vrrp[25026]: VRRP_Instance(VI_1) Transition to MASTER STATE
Keepalived_vrrp[25026]: VRRP_Instance(VI_1) Entering MASTER STATE
ntpd[1954]: Listen normally on 99 eth0.460 192.168.54.4 UDP 123
question from:
https://stackoverflow.com/questions/65918937/keepalived-interface-down-up-behavior