On Tue, Mar 5, 2013 at 7:32 PM, Dhaval Jaiswal <dhaval.jais...@via.com>wrote:
> 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 > You have two backends with the same name, you might rename them http and https... I presume that you are using HTTPS on port 443, you can either do SSL offloading, as per the excellent blog entry below, or use mode tcp http://blog.exceliance.fr/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/ Cheers Arne