Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
109 views
in Technique[技术] by (71.8m points)

Keepalived Interface Down-Up Behavior

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...