[Linux-cluster] Least Conection with haproxy

Sam Wun swun2010 at gmail.com
Sun May 31 07:35:26 UTC 2009


Hi,

I just copied the leastconnection conf file to the working directory ,
started up haproxy,
but it doesn't really work.
Here is the conf file:

global
        maxconn    1000
        stats socket /tmp/sock1 mode 600
        stats timeout 3000
        stats maxconn 2000
        daemon

listen  webfarm 0.0.0.0:80
        mode       http
        retries    1
        option redispatch
        contimeout 1000
        clitimeout 120000
        srvtimeout 120000
        maxconn    40000
        ##bind       :8080
        balance    leastconn
        option     allbackups
        server     wp5 192.168.1.246:80 weight 10 maxconn 200 check
inter 1000 fall 1
        server     wp2 192.168.1.245:80 weight 20 maxconn 200 check
inter 1000 fall 1
        server     wp3 192.168.1.244:80 weight 30 maxconn 200 check
inter 1000 fall 1
        server     wp4 192.168.1.243:80 weight 40 maxconn 200 check
inter 1000 fall 1
        server     wp1 192.168.1.242:80 weight 10 check inter 1000 fall 1 backup
        option     httpclose

But the following conf works:

global
        #log 127.0.0.1  local0
        #log 127.0.0.1  local1 notice
        #log loghost    local0 info
        log localhost   local0 info
        maxconn 4096
        #chroot /usr/share/haproxy
        #uid 99
        #gid 99
        daemon
        pidfile /var/run/haproxy.pid
        #debug
        #quiet


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

listen web_appl 0.0.0.0:80
        mode http
        cookie SERVERID insert nocache indirect
        balance roundrobin
        server wp1 192.168.1.246:80 cookie server01 weight 1 check
        server wp2 192.168.1.245:80 cookie server02 weight 1 check
        server wp3 192.168.1.244:80 cookie server03 weight 1 check
        server wp4-backup 192.168.1.243:80 cookie server04 check backup
        server wp5-backup 192.168.1.242:80 check backup
        #option abortonclose # Dropping aborted requests
        #option nolinger        # disables data lingering

How to setup haproxy with Least Connection?\

Your help is very much appreciated.
Thanks




More information about the Linux-cluster mailing list