Unexpected behaviour when dynamically add node in HAproxy server

Posted by Anand Soni on Server Fault See other posts from Server Fault or by Anand Soni
Published on 2012-05-14T08:13:08Z Indexed on 2012/06/10 4:42 UTC
Read the original article Hit count: 592

I wanted to use HAProxy for my web app for load balancing purpose. I am trying to add a new rabbitmq node dynamically in HAProxy server using command : haproxy -p /var/run/haproxy.pid -sf $(cat /var/run/haproxy.pid). I am doing tcp connection mode with leastconn balance algorithm in load balancing. What is expected is when there is 3 connection in one rabbitmq, I add a new rabbit server in HAProxy server. so the next connection would pass to 2nd rabbitmq server which is not happening in my case. It distributes the connection in haphazardly manner.

Here is my config file:

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        maxconn 2000
        contimeout      5000
        clitimeout 5000
        srvtimeout 5000
listen rabbitmq 0.0.0.0:5672
         mode    tcp
         stats   enable
         balance leastconn
        option tcplog
        server  rabbit01 xx.xx.xx.xx:5672 check
        server  rabbit02 xx.xx.xx.xx:5672 check
listen tomcatq 0.0.0.0:80
         mode    http
         stats   enable
         balance roundrobin
         stats refresh 10s
        stats refresh 10s
        stats uri     /lb?stats
        stats auth    admin:admin
         option httplog         

What is the problem causing this behavior? Any suggestion will appreciated.

© Server Fault or respective owner

Related posts about amazon-ec2

Related posts about load-balancing