I am a complete newbie in Load balancing and because many suggested HAProxy I have started to do some extensive reading on it and tried many options.
To be honest, I am completely lost and really need help.
We have a web system hosted on a Windows IIS Server which works perfectly. We have several copies of this system and for each copy we have an address like ww1.system.com, ww2.system.com etc…All working well.
Then we also have a Linux server where we installed HAProxy. We point a domain www.system.com to this server.
So all we want is for when a user enters www.system.com that HAProxy gets the request on this server, and according to roundrobin or leastconnections choose a ww1 to ww10 alternative and reroute it. It should not handle responses as it is merely a redirect.
Preferably IIS should not even be aware of it. The user can see ww1 in the address bar - that doesn’t matter.
I have tried MANY options but cannot get it to work.
Help will really be appreciated.
you should start with one of the simple configs. haproxy can do a lot more than just loadbalancing. you can setup ACL, do redirects based on url path etc.
but with your simple requirements something like
IP 18.104.22.168 is the ip address of your haproxy server.
in this sample we do http balancing (on port 80). you also can do SSL loadbalancing but this will need some more (but not really complicated) config
you can also have “sticky” servers based on client-ip or cookie/session var if it is possible. so that one client request will hit every time the same backend server to maintain the user-session
timeout client 10s
timeout connect 5s
timeout server 10s
timeout http-request 10s
server server1 ww1.system.com:80
server server2 ww2.system.com:80
server server3 ww3.system.com:80
this is the most simply way of load balancing. you can do a server weight for each backend. you can enable stat page for haproxy even with maintaining options where you can disable one of the backend servers
user will always see www.system.com. no “redirect” or “url-change” to wwx.system.com.
IIS will see ip-address of haproxy as “client address”. there is somehting like http_forwared_for which you can set so that you will see the real clients ip address
Thank you so much! In the meantime I got it to work!