6.3. Setting up mod_jk

  1. Install the Apache server and 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 is existing 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 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 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. Set up workers in /etc/httpd/ (or /etc/apache2/ for Ubuntu) and create workers.properties file. In this step, use the node names which are assigned to -Djboss.node.name. 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:

    /portal=loadbalancer
    /portal/*=loadbalancer
    /eXo*=loadbalancer
    /eXoResources*/*=loadbalancer
    /exo*=loadbalancer
    /exo*/*=loadbalancer
    /web=loadbalancer
    /web/*=loadbalancer
    /integration=loadbalancer
    /integration/*=loadbalancer
    /dashboard=loadbalancer
    /dashboard/*=loadbalancer
    /rest=loadbalancer
    /rest/*=loadbalancer
    /jpp_branding_skin|/*=loadbalancer
    /jpp-branding-skin|/*=loadbalancer
    /jpp-branding-extension|/*=loadbalancer
    /status=status
    /status/*=status

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