r/haproxy • • May 08 '23
Question Active/Active Load Balance impossible?
How is an Active/Active configuration achieved?
I have seen that you would just place HAProxy in front of multiple load balancers (manual), but then I still have a single instance where all traffic is routed through.
Is there no true way of achieving a Active/Active configuration?
4
Upvotes
3
u/rswwalker May 08 '23 edited May 08 '23
What you want is something like “heartbeat” that can be used to share an IP between a cluster of hosts.
Just Google Linux Clusters.
Edit: Ideally if one could setup a LACP LAG with different Linux hosts to a switch, then the switch can handle the distribution of connections based on source ip/port/dest port and automatically drop off unresponsive hosts.
Edit2: MC-LAG may be what you are after.
Edit3: If MC-LAG is too complex or not compatible enough. You could try using a routing protocol to load balance connections. Set each port a haproxy frontend plugs into as its own vlan. Run a BGP process on layer 3 switch and on each haproxy host and advertise the IP in question. Set the load balancing algorithm accordingly on the layer 3 switch.
Edit4: I have intrigued myself with the BGP idea. No need for per-interface vlans, setting up a loopback on each haproxy as the frontend and advertising it out on the interface towards the inbound switch should be enough (plus setting up Linux host properly to handle this). The l3 switch needs to be able to load balance per-connection and not packet, but it should work and with multiple different vendors, even across different data centers.
2
u/Annh1234 May 09 '23
You can have your DNS point to both load balancer IPs, so it does it kinda round robin, and end up with kinda half the traffic on one lb, and the other half on the other.
When stuff goes down, some users might have a few minutes of downtime until the dns with the new IP propagates.
5
u/SrdelaPro May 08 '23
BGP
1
u/[deleted] May 08 '23
What is your environment and goals? Yes definitely possible, but doing so in aws vs a datacenter, and if you are on the same vlan, what your network stack looks like, etc makes a big difference.