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
  1. Create two new property files with suitable names. For example, Ajp_1.properties and Ajp_2.properties.
  2. Add the AJP connector port property in the two newly created property files.
    In Ajp_1.properties:
    <channel path>.ajp.connector.port=8011
    In Ajp_2.properties:
    <channel path>.ajp.connector.port=8012
  3. 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
  4. Configure the Apache HTTP server (“httpd”) as a fronting web server.
    1. Add the worker.properties file in Apache httpd under the config folder.
    2. Set the Apache http for load balancing in the worker.properties file.
    3. Configure two workers to listen to the above specified AJP ports.
    4. Disable one worker (for example, worker 2) by default, so that no requests are sent to it.
    5. 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.
  5. Add Tomcat connectors mod_jk.so under the modules folder.

    You can download mod_jk from the following location:

    http://tomcat.apache.org/download-connectors.cgi

  6. Configure Apache httpd to load this module.
    1. Redirect all requests to the load balancer defined earlier.
    2. 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>
  7. Start Apache server; Start both the instances of be-engines running the HTTP-based project.
  8. Open the browser and client server.
    1. 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.

  9. 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.