Error: keepalived + ipvs: doesn't balance with persistence to other node if persistent node fails.
We have the next configuration from keepalived.conf:
This is part of the configuration file /etc/keepalived/keepalived.conf:
virtual_server 192.168.58.10 443 {
delay_loop 5
lb_algo rr
lb_kind DR
persistence_timeout 3600
persistence_granularity 255.255.255.255
protocol TCP
sorry_server 192.168.58.200 443
real_server 192.168.58.201 443 {
weight 1
inhibit_on_failure
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 1
}
}
real_server 192.168.58.202 443 {
weight 1
inhibit_on_failure
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 1
}
}
}
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Weight PersistConn ActiveConn InActConn
-> RemoteAddress:Port
TCP 192.168.58.10:80 rr
-> 192.168.58.201:80 1 0 0 0
-> 192.168.58.202:80 1 0 0 0
TCP 192.168.58.10:443 rr persistent 3600
-> 192.168.58.201:443 1 0 0 0
-> 192.168.58.202:443 1 0 0 0
We have just restarted the system.
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Weight PersistConn ActiveConn InActConn
-> RemoteAddress:Port
TCP 192.168.58.10:80 rr
-> 192.168.58.201:80 1 0 0 2
-> 192.168.58.202:80 1 0 0 2
TCP 192.168.58.10:443 rr persistent 3600
-> 192.168.58.201:443 1 0 0 0
-> 192.168.58.202:443 1 0 0 0
We have connect to 192.168.58.10:80 four times from the same source address.
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Weight PersistConn ActiveConn InActConn
-> RemoteAddress:Port
TCP 192.168.58.10:80 rr
-> 192.168.58.201:80 1 0 0 2
-> 192.168.58.202:80 1 0 0 2
TCP 192.168.58.10:443 rr persistent 3600
-> 192.168.58.201:443 1 1 0 2
-> 192.168.58.202:443 1 0 0 0
We have connect to 192.168.58.10:443 two times from the same source address.
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Weight PersistConn ActiveConn InActConn
-> RemoteAddress:Port
TCP 192.168.58.10:80 rr
-> 192.168.58.201:80 1 0 0 2
-> 192.168.58.202:80 1 0 0 2
TCP 192.168.58.10:443 rr persistent 3600
-> 192.168.58.201:443 0 1 0 2
-> 192.168.58.202:443 1 0 0 0
We have stopped the web server 192.168.58.201:443.
We are trying to connect again, ipvs doesn't balance to the other web server 192.168.58.202:443 and waits 3600 seconds (in this case) to balance to it. We don't know te reason to do this, in our opinion it must balance to the other web server and think it could be a possible bug.
Can anyone explain this behaviour?
Thanks!
Jose Luis