apache loadbalancer

This Link is a doc file on how to configure apache to act as a load balancer.

Just in case the document would not last for ever, the scripting involved:

Definition on the virtual host level:


        ServerName www.yourcompany.com
 ServerAlias yourcompany.com

        DocumentRoot /Library/WebServer/Documents

        ProxyRequests Off

        
          Order deny,allow
          Allow from all
        

        ProxyPass /balancer-manager !
        ProxyPass / balancer://mycluster/ stickysession=JSESSIONID nofailover=On
        ProxyPassReverse / ajp://public1.yourcompany.com:8009
        ProxyPassReverse / ajp://public2.yourcompany.com:8009
        
          BalancerMember ajp://public1.yourcompany.com:8009 route=public1
          BalancerMember ajp://public2.yourcompany.com:8009 route=public2
          ProxySet lbmethod=byrequests
        

        
          SetHandler balancer-manager
        

        
    AllowOverride AuthConfig
 



Protection of the balance-manager path.

mkdir /Library/WebServer/Documents/balancer-manager
htpasswd -c /etc/apache2/conf/security/users administrator
cd /Library/WebServer/Documents/balancer-manager
touch .htaccess
vi .htaccess

Text to enter in the .htaccess file:


AuthName "secured"
AuthType Basic
AuthUserFile users

require valid-user

on the balanced server side:

Check the AJP port on the server:
jboss JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml
tomcat: TOMCAT_HOME/conf/server.xml 
Configuration of this file:


connection link


Not yet tested myself but will not take long ...

No comments: