Configure Apache Tomcat Load-Balancing

The following procedure demonstrates one way you can configure your Apache Tomcat server to use load-balancing that can be exploited by the  Web Services component.
ce18
The following procedure demonstrates one way you can configure your Apache Tomcat server to use load-balancing that can be exploited by the
CA Endevor
Web Services component.
The procedure in this article is neither a recommended best practice nor an exhaustive guide to setting up load-balancing in all environments. As an alternative to Web Services, you can also use the CA Brightside API Mediation Layer (API ML) Gateway to configure Apache Tomcat to use load-balancing.
Follow these steps:
  1. Download and install the Apache HTTP Server (HTTPD). HTTPD acts as a load-balancer and can be placed off the mainframe.
    For information about how to install HTTPD, including Windows-specific instructions, see the Apache HTTP Server website.
  2. Download the
    mod_jk
    extension for HTTPD from the "Tomcat Connectors (mod_jk) Downloads" section of the Apache Tomcat website.
    Ensure that the
    mod_jk.so
    module for your operating system is downloaded into the
    /modules
    folder of HTTPD.
  3. Edit
    httpd.conf
    in the Apache HTTPD
    /conf
    folder by adding the following line:
    LoadModule jk_module modules/mod_jk.so
  4. Set up AJ13 connectors on the load-balanced Apache Tomcat servers. For each Tomcat server that hosts
    CA Endevor
      Web Services, edit the
    server.xml
    file that is located in the
    /conf
    folder to add an AJP13 connector.
    Example: Edited server.xml file
    <Connector port="
    port
    " protocol="AJP/1.3" redirectPort="8443" maxThreads="150"> </Connector>
    If you have HTTPS set up, copy your HTTPS-enabled connector settings, change the protocol to "AJP/1.3", and either assign a new port or disable the existing connector in order to free up that port.
  5. Set up the configuration file worker:
    1. Create the file
      worker.properties
      in the
      /conf
      folder of HTTPD.
    2. Modify the
      httpd.conf
      file by adding load-balancer settings and pointing to the
      worker.properties
      file.
      Example: Edited load-balancer settings in httpd.conf file
      # Load balancer settings JkWorkersFile C:\ApacheHTTPD\Apache24\conf\worker.properties JkShmFile C:\ApacheHTTPD\Apache24\logs\mod_jk.shm JkLogFile C:\ApacheHTTPD\Apache24\logs\mod_jk.log JkLogLevel error JkMount /status status JkMount /* balancer JkOptions +ForwardURIProxy JkOptions +ForwardURICompatUnparsed
      Three options are available to ensure that the logs forwarded by HTTPD are left with the original Tomcat URL:
      JkOptions +ForwardURIProxy
      The forwarded URI is partially reencoded after processing inside Apache and before forwarding to Tomcat. This option is compatible with local URL manipulation by
      mod_rewrite
      and with URL-encoded session IDs.
      JkOptions +ForwardURICompatUnparsed
      The forwarded URI is unparsed, and is spec-compliant and secure. This option always forwards the original request URI, so rewriting URIs with
      mod_rewrite
      and then forwarding the rewritten URI does not work.
      JkOptions ForwardURICompat
      The forwarded URI is decoded by Apache. Encoded characters are decoded and explicit path components such
      ".."
      are already resolved. This option is less spec-compliant and is not safe if you are using prefix
      JkMount
      . This option allows the rewriting of URIs with
      mod_rewrite
      before forwarding.
      Message files are exempt from load-balancing.
    3. Edit the
      worker.properties
      file by setting up one worker per mainframe Tomcat instance that you want to load-balance.
      Example: Edited worker.properties file
      worker.list=balancer,status worker.tomcat1.type=ajp13 worker.tomcat1.port=AJP13 port of 1st tomcat worker.tomcat1.host=host name of 1st tomcat worker.tomcat2.type=ajp13 worker.tomcat2.port=port of 2nd tomcat worker.tomcat2.host=AJP13 host name of 2nd tomcat worker.balancer.type=lb worker.balancer.balance_workers=tomcat1, tomcat2 worker.status.type=status
      For more information about setting up the worker configuration file, see the "Apache HTTP Server HowTo" section of the Apache Tomcat Connectors documentation.
  6. Start all the servers and direct all
    CA Endevor
    REST API requests to the HTTPD server to make use of load-balancing.
    The default URL for accessing the REST API is the same URL that is used for direct access to Tomcat:
    http://
    host
    :
    post
    /EndevorService/rest/