Haproxy Across Sites

So im new to haproxy, also, im no Linux admin, but i know my way around. i am working with Ubuntu 18.04.

the picture above is an example of what im trying to accomplish.

I have 1 haproxy server and 2 nodes at 2 separate locations, currently set up for testing purposes. Both locations are currently working within the network just fine. What i need, is if SITE 1, NODE 1 goes down, i need all traffic to be forwarded to SITE 2, Node 1…etc.

Eventually, there will be 3 sites all together.

Do i need a haproxy server to load-balance my haproxy servers? Is that a thing?


Still new about HAProxy, but first question to you is do you need any kind of persistence / session syncrhonisation between your servers ? If you have user authentication on that web service, you probably need to ensure what your web service can do about load balancing first.

If we forget about sessions, what you need is to define all 4 backends in both of your HAProxy and let it monitor all of them. HAProxy will distribute the load to the servers that are available and best responding.

If Node 1 on site 1 goes down, Node 2 on site 1 will probably be a better match.

If Node 1 and Node 2 are not the same and a failed Node 1 on site 1 can be compensated only by Node 1 on site 2, than you need to create two groups that again will be monitored by HAProxy. Either from two frontend or a single frontend that will route to the proper node based on host name, path or whatever you need to do.

For more details, I think you need to tell us more yourself first…

Good luck