Hi List,

I am newbee to set up the HAProxy. I wanted to set up the HAProxy between
the httpd apache web server & tomcat apps server as a load balancer.
Currently we are using sticky session for the load balancing. However,
HAProxy, we can use the round robin method to balance all the request
coming from the web server to the apps server and properly utilizing all
the apps. server in terms of request handling and load balancing. As of now
sometimes one apps server is heavily loaded while the other one is not
serving a single request or very less request handling.

I wanted to set up with one httpd web server & 3 tomcat apps server


Example Network

    192.168.1.68: Web server
    192.168.1.45: App server 1
    192.168.1.46: App server 1
    192.168.1.47: App server 1
    192.168.1.50: HAProxy host

Will below config works. Kindly add your inputs.

haproxy.cfg

global
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

defaults
    mode                    http
    log                     global
    option                  httplog
    option                  dontlognull
    option http-server-close
   # option forwardfor       except 127.0.0.0/8
    option                  redispatch
    retries                 3
    timeout http-request    1m
    timeout queue           1m
    timeout connect         30s
    timeout client          10m
    timeout server          10m
    timeout http-keep-alive 10s
    timeout check           10s
    maxconn                 3000

frontend  http 192.168.1.68:80
frontend  http 192.168.1.68:443
    acl www.xyz.com       path_beg       -i /static /images /javascript
/stylesheets
    acl www.xyz.com       path_end       -i .jpg .gif .png .css .js
    use_backend static          if www.xyz.com
    default_backend             www.xyz.com

backend app
    balance     roundrobin
    server  www.xyz.com 192.168.1.45:80 check
    server  www.xyz.com 192.168.1.46:80 check
    server  www.xyz.com 192.168.1.47:80 check

backend app
    balance     roundrobin
    server  www.xyz.com 192.168.1.45:443 check
    server  www.xyz.com 192.168.1.46:443 check
    server  www.xyz.com 192.168.1.47:443 check

Reply via email to