Suresh Payankannur

Monday, November 18, 2013

Apache Load Balancing & Fail Over with mod_proxy

Apache mod_proxy and the extension mod_proxy_balancer can be used for load balancing and fail over. The following setup is used for two downstream Tomcat servers with a candidate web app deployed at the root.

httpd.conf (On Mac OS, Mavericks)
LoadModule proxy_module libexec/apache2/
LoadModule proxy_ajp_module libexec/apache2/
LoadModule proxy_balancer_module libexec/apache2/
ProxyRequests Off
<Proxy balancer://cluster>
    BalancerMember ajp://localhost:8009  loadfactor=1 ping=10
    BalancerMember ajp://localhost:18009 loadfactor=2 ping=10
ProxyPass          /status   !
ProxyPass          /balancer !
ProxyPass          /         balancer://cluster/
ProxyPassReverse   /         balancer://cluster/

ProxyStatus On
<Location /status>
    SetHandler server-status
    Order Deny,Allow
    Deny from all
    Allow from all

<Location /balancer>
    SetHandler balancer-manager
    Order Deny,Allow
    Deny from all
    Allow from all


Post a Comment

Blog Archive

Scroll To Top