Setting Up Fault Tolerance for the HTTP Channel
Use the Apache HTTP server (“httpd”) and mod_jk to setup fault tolerance to the TIBCO BusinessEvents HTTP channel and a third-party fronting server. These properties are used in addition to sharing the cache server between the nodes in the cluster.
- Procedure
- Create two new property files with suitable names. For example,
Ajp_1.properties
andAjp_2.properties
. - Add the AJP connector port property in the two newly created property files.
In
Ajp_1.properties
:<channel path>.ajp.connector.port=8011
InAjp_2.properties
:<channel path>.ajp.connector.port=8012
- Specify the new property files as part of the TRA file of individual engines. Ensure that there is one properties file per engine.
java.property.be.channel.external.config.file=<location of properties file>
For example,java.property.be.channel.external.file=/tibco/app/conf/Ajp_1.properties
java.property.be.channel.external.file=/tibco/app/conf/Ajp_2.properties
- Configure the Apache HTTP server (“httpd”) as a fronting web server.
- Add the
worker.properties
file in Apache httpd under theconfig
folder. - Set the Apache http for load balancing in the
worker.properties
file. - Configure two workers to listen to the above specified AJP ports.
- Disable one worker (for example, worker 2) by default, so that no requests are sent to it.
- Configure another worker (worker1), so that in case of a failure, it redirects all incoming requests to the disabled worker (worker2).
The
worker.propeties
file should contain the following properties:worker.list=balancer worker.balancer.type=lb worker.balancer.sticky_session=0 worker.balancer.balance_workers=worker1,worker2 worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8011 worker.worker1.redirect=worker2 worker.worker2.type=ajp13 worker.worker2.host=localhost worker.worker2.port=8012 worker.worker2.activation=disabled
Worker1, in case of a failure, now becomes the active worker. - Add the
- Add Tomcat connectors
mod_jk.so
under themodules
folder.You can download
mod_jk
from the following location: - Configure Apache httpd to load this module.
- Redirect all requests to the load balancer defined earlier.
- Add the following snippet to
httpd.conf
, after completion of all the basic module load statements:
LoadModulejk_modulemodules/mod_jk.so <IfModule jk_module> JkWorkersFile conf/worker.properties JkLogFile logs/mod_jk.log JkLogStampFormat "[%b %d %Y - %H:%M:%S] " JkRequestLogFormat "%w %V %T" JkLogLevel info JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories <Location//WEB-INF/> deny from all </Location> JkMount /* balancer </IfModule>
- Start Apache server; Start both the instances of be-engines running the HTTP-based project.
- Open the browser and client server.
- Enter the URL
http://localhost/
<context-path>
, without any port.
The request is now routed to the active worker (worker1) only, since the other worker (worker2) is disabled. You can verify through logs that logs are being created for one be-engine only.
- Enter the URL
- Shut down the active be-engine associated with the active worker (worker1).
All subsequent requests from the client now route to other worker (worker2). To verify, check the logs in the corresponding be-engine instance.