Restarting Haproxy Gracefully

Posted by Anand Gupta on Server Fault See other posts from Server Fault or by Anand Gupta
Published on 2011-11-13T08:29:39Z Indexed on 2011/11/14 17:54 UTC
Read the original article Hit count: 552

As per various blogs, HAproxy can be gracefully restarted using the following command:

sudo haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/ -sf $(cat /var/run/

TO verify this, I had set up a apache bench script which contiguously sent message to haproxy. Ideally, whenever I restarted my server the script should not have an affect on the apache bunch execiton. But, it seems that whenever Haproxy is restarted apache bench scripts terminate and the connection to load balancer is lost.

Here is the details of my HaProxy configuration file :

    nbproc 4
    log   local0
    log   local1 notice
    #log loghost    local0 info
    maxconn 4096
    #chroot /usr/share/haproxy
    user haproxy
    group haproxy
    pidfile /var/run/
    stats socket /home/ubuntu/haproxy.sock

    log     global
    mode    http
    option  httplog
    option  dontlognull
    retries 3
    option redispatch
    maxconn 2000
    contimeout      5000
    clitimeout      50000
    srvtimeout      50000

    listen webstats
    stats enable
    mode http
    stats uri /lb?stats
    stats auth anand:aaaaaaaa
    #stats refresh

    listen web-farm
         mode http
         balance roundrobin
         option httpchk HEAD /index.php HTTP/1.0

Please let me know what am I missing here.

© Server Fault or respective owner

Related posts about configuration

Related posts about amazon-ec2