Using Load Balancer

If XPLG cluster is running with multiple UI nodes, it is recommended to install a Load Balancer in front of the XPLG cluster so that users will be automatically redirected to the UI nodes.

The following example explains how to set up Apache Httpd server as a load Load Balancer:

  1. Set up Apache httpd server on Linux.

  2. Download the latest version of mod_jk from Apache web site. Copy this file into the Apache modules/ directory and rename it to mod_jk.so.

  3. Configure Apache:

    1. Edit the file httpd.conf (Apache configuration path usually: /etc/httpd/conf/httpd.conf)
      Note that the default port is usually 80, change it if needed but make sure that the ports you use are available.

      Add the following right after the other LoadModule directives: 
      LoadModule jk_module modules/mod_jk.so
      Add the following at the end of the httpd.conf file:
      # Where to find workers.properties
      JkWorkersFile /etc/httpd/conf/workers.properties
      # Where to put jk shared memory
      JkShmFile     /var/log/httpd/mod_jk.shm
      # Where to put jk logs
      JkLogFile     /var/log/httpd/mod_jk.log
      # Set the jk log level [debug/error/info]
      JkLogLevel    info


      # Select the timestamp log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
      JkMount /* balancer
      JkMount /*/* balancer

    2. Create workers.properties
      The worker.properties file should be located in the /etc/httpd/conf/ directory. In the file you should have the following parameters set for the UI1, UI2 nodes:
      Define the list of workers that will be used
      worker.list=balancer
      worker.balancer.type=lb
      worker.balancer.balance_workers=ui1,ui2
      worker.balancer.method=B
      # Specifies whether requests with SESSION ID's
      # should be routed back to the same #Tomcat worker
      worker.balancer.sticky_session=True
      # Define UI1
      worker.ui1.port=<UI1_JK_PORT>
      worker.ui1.host= <UI1_JK_IP>
      worker.ui1.type=ajp13
      worker.ui1.lbfactor=1
      # Define UI2
      worker.ui2.port=<UI2_JK_PORT>
      worker.ui2.host= <UI2_JK_IP>
      worker.ui2.type=ajp13
      worker.ui2.lbfactor=1

  4. Configure Tomcat on each of the UI nodes:

    1. On each of the XPLG UI nodes, edit the file <UI1_NODE_INSTALLATION_DIR>/ServletContainer/conf/server.xml

    2. Go to the following XML Tag:
      <!-- Define an AJP 1.3 Connector on port 8009 -->
      <Connector port="8011"  enableLookups="false" redirectPort="30445" protocol="AJP/1.3" />

      Set up the port to the same as <UI1_JK_PORT>
      Go to the following Engine tag to set the ui node name must be like the one in the Apache workers.properties used name:
      <!-- You should set jvmRoute to support load-balancing via AJP ie :–>
      <Engine name="Catalina" defaultHost="localhost" jvmRoute="ui1">

  5. Activate and Verify:
    After completing the above step - restart UI1, UI2 and the Apache server
    Users should use the URL to the Apache http://<HTTPD-IP>:<HTTPD-PORT>, and the Apache server will redirect the users to the UI nodes.

Â