Sunday 13 April 2014

Apache Load balancer Setup Using Proxy Balancer Module


prerequisites:
1. Install and configure Apache for LB clients (192.168.10.2 & 192.168.10.3)
2. Configure below machine (192.168.10.1) as Apache LB


#cd /usr/local/src/httpd-2.2.21
#./configure --prefix=/usr/local/apache --enable-shared=max --enable-module=rewrite --enable-module=so --enable-proxy=shared
#make
#make install

#vim /usr/local/apache/conf/httpd.conf
##Add below lines

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so

<VirtualHost www.apache-lb.com:80>
        ProxyRequests off

        ServerName www.apache-lb.com

        ErrorLog "logs/lbtest-error_log"
       CustomLog "logs/lbtest-access_log" common

        <Proxy balancer://mycluster>
                # WebHead1
                BalancerMember http://192.168.10.1:80
                # WebHead2
                BalancerMember http://192.168.10.2:80

                # Security "technically we aren't blocking
                # anyone but this the place to make those
                # chages
                Order Deny,Allow
                Deny from none
                Allow from all

                # Load Balancer Settings
                # We will be configuring a simple Round
                # Robin style load balancer.  This means
                # that all webheads take an equal share of
                # of the load.
                ProxySet lbmethod=byrequests

        </Proxy>

        <Location /balancer-manager>
                SetHandler balancer-manager

                # I recommend locking this one down to your
                # your office
                Order deny,allow
                Allow from all
        </Location>

               ProxyPass /balancer-manager !
               ProxyPass / balancer://mycluster/

</VirtualHost>

#/usr/local/apache/bin/apachectl -f /usr/local/apache/conf/httpd.conf

No comments:

Post a Comment