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.
The following procedure demonstrates one way you can configure your Apache Tomcat server to use load-balancing that can be exploited by the
CA EndevorWeb 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:
- 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.
- Download themod_jkextension for HTTPD from the "Tomcat Connectors (mod_jk) Downloads" section of the Apache Tomcat website.Ensure that themod_jk.somodule for your operating system is downloaded into the/modulesfolder of HTTPD.
- Edithttpd.confin the Apache HTTPD/conffolder by adding the following line:LoadModule jk_module modules/mod_jk.so
- Set up AJ13 connectors on the load-balanced Apache Tomcat servers. For each Tomcat server that hostsCA EndevorWeb Services, edit theserver.xmlfile that is located in the/conffolder 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.
- Set up the configuration file worker:
- Create the fileworker.propertiesin the/conffolder of HTTPD.
- Modify thehttpd.conffile by adding load-balancer settings and pointing to theworker.propertiesfile.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 +ForwardURICompatUnparsedThree options are available to ensure that the logs forwarded by HTTPD are left with the original Tomcat URL:JkOptions +ForwardURIProxyThe forwarded URI is partially reencoded after processing inside Apache and before forwarding to Tomcat. This option is compatible with local URL manipulation bymod_rewriteand with URL-encoded session IDs.JkOptions +ForwardURICompatUnparsedThe forwarded URI is unparsed, and is spec-compliant and secure. This option always forwards the original request URI, so rewriting URIs withmod_rewriteand then forwarding the rewritten URI does not work.JkOptions ForwardURICompatThe 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 prefixJkMount. This option allows the rewriting of URIs withmod_rewritebefore forwarding.Message files are exempt from load-balancing.
- Edit theworker.propertiesfile by setting up one worker per mainframe Tomcat instance that you want to load-balance.Example: Edited worker.properties fileworker.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=statusFor more information about setting up the worker configuration file, see the "Apache HTTP Server HowTo" section of the Apache Tomcat Connectors documentation.
- Start all the servers and direct allCA EndevorREST 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/