how to setup apache load balancing with mod_proxy_ajp

Version 1
    Share This:

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    PRODUCT:

    Remedy AR System Server


    COMPONENT:

    AR System Mid Tier


    APPLIES TO:

    Any web application with tomcat as JSP engine and load balancing requirements



    QUESTION:

    How to setup load balancing with apache http server using mod_proxy_ajp ? 

    What is different compared to mod_jk?


    ANSWER:

    Mod_jk only has one kind of connectivity protocol option, which is ajp. ajp is a binary protocol and ajp connections are very fast.

    Mod_proxy, on the other hand, has four different types of connection options, plus a fifth option that allows you to set up load-balanced clusters of nodes. There is a connector for ftp, one for http, one for ajp, and one for when your backend system is an ssl encrypted (https) session. 

    Once apache is setup and working define a new .conf file that can be read by apache http server such as

    File created in this path
    vi /etc/httpd/sites-available/arsys.conf

    And httpd.conf file reads all optional files in that directory
    IncludeOptional sites-available/*.conf

    The contents of file arsys.conf is

    <Proxy "balancer://mycluster">
        BalancerMember "ajp://localhost:10009/arsys" route=arsys_vol1
        BalancerMember "ajp://localhost:11009/arsys" route=arsys_vol2
    </Proxy>
    ProxyPass "/arsys" "balancer://mycluster" stickysession=JSESSIONID|jsessionid scolonpathdelim=On
    ProxyPassReverse "/arsys" "balancer://mycluster"

    This means
    <Proxy "balancer://mycluster">  Define a label for the proxy
        BalancerMember "ajp://localhost:10009/arsys" route=arsys_vol1 Define the protocol, server, port and route for this load balancer member
        BalancerMember "ajp://localhost:11009/arsys" route=arsys_vol2
    </Proxy>
    ProxyPass "/arsys" "balancer://mycluster" stickysession=JSESSIONID|jsessionid scolonpathdelim=On  
    This previous line maps the path /arsys to the label "mycluster, uses session affinity using a cookie called JSESSION or jsession 
    the scolonpathdelim is for the cookie format

    "The Java standards implement URL encoding slightly different. They use a path info appended to the URL using a semicolon (;) as the separator and add the session id behind. As in the cookie case, Apache Tomcat can include the configured jvmRoute in this path info. To let Apache find this sort of path info, you neet to set scolonpathdelim to On in ProxyPass or ProxySet."

    ProxyPassReverse "/arsys" "balancer://mycluster"

    Finally this one will serve as the reverseproxy 

      

      

     


    Article Number:

    000151753


    Article Type:

    FAQ/Procedural



      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles