I am going to use HAProxy as a load balancer that will balance requests on 3 application servers. But what if balancer server (HAProxy) fails at some point? I was thinking of cloning the first balancer, so if the main one fails the other will take its place. Something like HSRP.

Is it possible? if yes how?


This is typically done using some form of VRRP maintaining a virtual IP address across 1 or more servers, each running HAproxy.

This is typically done with keepalived, there's a guide here which should help.

Note that several people use Heartbeat for this, but Willy Tarreau (the guy behind HAproxy) has mentioned it isn't the best tool for the job. You can read more on that in this message from the HAproxy mailing list.

  • 1
    As people say, you can using something like keepalived or heartbeat to failover to a 2nd box, but remember you need to have your config in sync too. I modified the init.d script to sync the config on restart. – Coops Mar 1 '11 at 8:10

High availability HAProxy setup is possible with Heartbeat on Linux or CARP or BSD systems.
It requires one "floating" IP address (which will be used for HAProxy), which will be assigned to one of computers in cluster. One current computer holding IP address fails, failover server will take IP address and continue serving requests. If you combine CARP with pfsync, TCP connection state will be synced between servers and failover will be "seamless"


HSRP only works on Cisco switches and routers.

You can use uCARP(CARP protocol) or vrrpd(VRRP protocol). Requires that both HAproxy are on the same network.

If your gateway support OSPF, you can use OSPF(Quagga). You can set different OSPF interface priority. When one HAproxy fail, gateway delete it from router table.

  • Are you aware of any tools that would allow HA pairing of HAProxy across disparate sites? For example, redundancy between east coast and west coast datacenters? – duct_tape_coder Aug 8 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.