HA Proxy won't load balance my web requests. What have I done wrong?
Posted
by
Josh Smeaton
on Server Fault
See other posts from Server Fault
or by Josh Smeaton
Published on 2011-02-04T06:59:25Z
Indexed on
2011/02/04
7:27 UTC
Read the original article
Hit count: 530
I've finally got HA Proxy set up and running in a way I think I want. However, it is not load balancing the web requests it receives. All requests are currently being forwarded to the first server in the cluster. I'm going to paste my configuration below - if anyone can see where I may have gone wrong, I'd appreciate it.
This is my first stab at configuring web servers in a *nix environment.
First up, I have HA Proxy running on the same host as the first server in the apache cluster. We are moving these servers to virtual later on, and they will have different virtual hosts, but I wanted to get this running now.
Both web servers are receiving their health checks, and are reporting back correctly. The haproxy?stats page correctly reports servers that are up and down. I've tested this by altering the name of the file that is checked. I haven't put any load onto these servers yet. I've just opened up the URLs on several tabs (private browsing), and had several co-workers hit the URL too. All of the traffic goes to WEB1. Am I balancing incorrectly?
global
maxconn 10000
nbproc 8
pidfile /var/run/haproxy.pid
log 127.0.0.1 local0 debug
daemon
defaults
log global
mode http
retries 3
option redispatch
maxconn 5000
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen WEBHAEXT :80,:8443
mode http
cookie sessionbalance insert indirect nocache
balance roundrobin
option httpclose
option forwardfor except 127.0.0.1
option httpchk HEAD health_check.txt
stats enable
stats auth rah:rah
server WEB1 10.90.2.131:81 cookie WEB_1 check
server WEB2 10.90.2.130:80 cookie WEB_2 check
© Server Fault or respective owner