HAProxy community

Preserve server states during failover

Hi,

In an active passive setup with keepalived (floating IP) and two haproxy servers (both running), what would be the possibility to preserve the server states during failover from one HAProxy to the other?

Locally its possible to maintain the server state during restarts with “server-state-file”.
Is there a (peering) mechanism available that both HAProxies are in sync with the server states, configured by the stats page.

Please let me know what thoughts you have…

Maarten

There is no need for this as the passive node is actually always active in terms of health checking and everything else.

In fact, the only thing that makes the standby instance “passive” is the fact that the virtual/floating IP is not there.

Hi,

Well, that is true, but there are situations where a server in a backend has been put in maintenance mode via the stats page.
If after a server has been put in maint mode we switch from one HAProxy to the other one (move the floating IP), then on that HAProxy the server is obviously not in maintenance mode.
Which can lead to unwanted situations.

Maarten

I see, there is no synchronization for this and I’m not sure there ever will be.

The server-state-file has a different use-case entirely and can certainly not be used for this.

I believe those things are usually abstracted away by a provisioning layer in front, so you would actually not mark a server in maintenance mode on a haproxy instance itself, but on a configuration frontend or orchestration that then propagates whatever changes to all the instances.

There is no solution for this in vanilla haproxy.

Thanks,

At least I know I dont need to look into HAProxy itself for a solution, either as you say by a provisioning layer or by having a look at the data plane API to create something.

Thanks!