7.7. Setting up mod_jk

  1. Install the Apache server and the mod_jk module.

    • On Fedora, the package containing Apache HTTP Server is named httpd. You will probably need to build and install mod_jk from sources. In this case, the httpd-devel package might be useful. Verify that the mod_jk.so file exists in /etc/httpd/modules.

    • On Ubuntu, the packages are named apache2 and libapache2-mod-jk.

  2. Set up Apache to use mod_jk.

    • If you use Fedora and recent version of Apache (2.2+), put the mod-jk.conf file into /etc/httpd/conf.d. Do not forget to load the module by appending the following line to /etc/httpd/conf/httpd.conf:

      LoadModule jk_module modules/mod_jk.so

      The mod-jk.conf file looks like this:

      ...
      JkWorkersFile /path/to/file/workers.properties
      
      # Where to put jk logs
      JkLogFile /var/log/apache2/mod_jk.log
      
      # Set the jk log level [debug/error/info]
      JkLogLevel debug
      
      # Select the log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
      
      # JkOptions indicates to send SSK KEY SIZE
      JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
      
      # JkRequestLogFormat
      #JkRequestLogFormat "%w %V %T"
      
      JkMountFile /path/to/file/uriworkermap.properties
      
      # Add shared memory.
      # This directive is present with 1.2.10 and
      # later versions of mod_jk, and is needed for
      # for load balancing to work properly
      JkShmFile /var/log/apache2/jk.shm
      
      # Add jkstatus for managing runtime data
      <Location /jkstatus/>
      JkMount status
      </Location>
      ...
    • In Ubuntu, typically during installation of libapache2-mod-jk, the mod_jk is enabled automatically, by creating jk.load and jk.conf under /etc/apache2/mods-available, as well as their symlinks under /etc/apache2/mods-enabled. You need to edit /etc/apache2/mods-available/jk.conf with the content above.

  3. Create workers.properties file with the path you configured above. Replace "node1" and "node2" with the values of exo.cluster.node.name variable. The workers.properties file looks like this:

    # Define list of workers that will be used for mapping requests
    worker.list=loadbalancer,status
    
    # modify the host as your host IP or DNS name
    worker.node1.port=8009
    worker.node1.host=192.168.210.101
    worker.node1.type=ajp13
    worker.node1.lbfactor=1
    
    ## modify the host as your host IP or DNS name
    worker.node2.port=8009
    worker.node2.host=192.168.210.102
    worker.node2.type=ajp13
    worker.node2.lbfactor=1
    
    # Load-balancing behaviour
    worker.loadbalancer.type=lb
    worker.loadbalancer.method=Session
    worker.loadbalancer.balance_workers=node1,node2
    worker.loadbalancer.sticky_session=1
    
    #worker.list=loadbalancer
    worker.status.type=status

    And the uriworkermap.properties file should look like this:

    /status=status
    /status/*=status
    /*=loadbalancer

Note

In Platform JBoss, you need to configure an AJP connector, as described below.

You need to modify the $PLATFORM_JBOSS_HOME/standalone/configuration/standalone-exo-cluster.xml file. Find the subsystem urn:jboss:domain:web:1.5 section and add the connector:


<subsystem xmlns="urn:jboss:domain:web:1.5" default-virtual-server="default-host" native="false">
    ...
    <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
    ...
</subsystem>

Troubleshooting

You have configured everything properly, but are still unable to access the portal via Apache. When accessing eXo Platform via Apache, you get the "503 Service Temporarily Unavailable" response. The cluster itself is working and you can access individual eXo Platform nodes directly. According to mod_jk.log, mod_jk is working, but Tomcat is reported as likely not to be running on the specified port.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus