7

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?

3 Answers 3

14

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
  • 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, 2011 at 8:10
2

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"

2

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.

1
  • 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? Aug 8, 2019 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .