How to Setup Load Balancing in JBoss EAP 6 with mod_cluster

Domain Mode w/ Dynamic Proxy Configuration

1) Copy the <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_advertise.so, <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_manager.so, <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_proxy_cluster.so and <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_slotmem.so files to the <Apache Install Dir>/modules directory.

2) Create the <Apache Install Dir>/conf.d/mod_cluster.conf file:

LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so

MemManagerFile /var/cache/mod_cluster

Listen host:6666

<VirtualHost host:6666>
  ServerAdvertise On
  EnableMCPMReceive
  <Location /mod_cluster-manager>
    SetHandler mod_cluster-manager
  </Location>
</VirtualHost>

3) Change the configuration of the web subsystem in the ha and full-ha profiles in the <JBoss EAP Install Dir>/domain/configuration/domain.xml file:

<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" instance-id="${jboss.node.name:host}" native="false">
  ...
</subsystem>

4) Start Apache.

5) Start JBoss EAP.

Domain Mode w/ Static Proxy Configuration

1) Copy the <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_manager.so, <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_proxy_cluster.so and <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_slotmem.so files to the <Apache Install Dir>/modules directory.

2) Create the <Apache Install Dir>/conf.d/mod_cluster.conf file:

LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

MemManagerFile /var/cache/mod_cluster

Listen host:6666

<VirtualHost host:6666>
  EnableMCPMReceive
  <Location /mod_cluster-manager>
    SetHandler mod_cluster-manager
  </Location>
</VirtualHost>

3) Change the configuration of the web subsystem in the ha and full-ha profiles in the <JBoss EAP Install Dir>/domain/configuration/domain.xml file:

<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" instance-id="${jboss.node.name:host}" native="false">
  ...
</subsystem>

4) Change the configuration of the modcluster subsystem:

<subsystem xmlns="urn:jboss:domain:modcluster:1.1">
  <mod-cluster-config advertise="false" connector="ajp" proxy-list="host:6666">
    ...
  </mod-cluster-config>
</subsystem>

5) Start Apache.

6) Start JBoss EAP.

Stand-Alone Mode w/ Dynamic Proxy Configuration

1) Copy the <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_advertise.so, <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_manager.so, <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_proxy_cluster.so and <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_slotmem.so files to the <Apache Install Dir>/modules directory.

2) Create the <Apache Install Dir>/conf.d/mod_cluster.conf file:

LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so

MemManagerFile /var/cache/mod_cluster

Listen host:6666

<VirtualHost host:6666>
  ServerAdvertise On
  EnableMCPMReceive
  <Location /mod_cluster-manager>
    SetHandler mod_cluster-manager
  </Location>
</VirtualHost>

3) Start Apache.

4) Start JBoss EAP.

Stand-Alone Mode w/ Static Proxy Configuration

1) Copy the <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_manager.so, <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_proxy_cluster.so and <JBoss EAP Webserver Connector Native Install Dir>/modules/system/layers/base/native/lib64/httpd/modules/mod_slotmem.so files to the <Apache Install Dir>/modules directory.

2) Create the <Apache Install Dir>/conf.d/mod_cluster.conf file:

LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

MemManagerFile /var/cache/mod_cluster

Listen host:6666

<VirtualHost host:6666>
  EnableMCPMReceive
  <Location /mod_cluster-manager>
    SetHandler mod_cluster-manager
  </Location>
</VirtualHost>

3) Change the configuration of the modcluster subsystem in the <JBoss EAP Install Dir>/standalone/configuration/standalone-ha.xml and <JBoss EAP Install Dir>/standalone/configuration/standalone-full-ha.xml files:

<subsystem xmlns="urn:jboss:domain:modcluster:1.1">
  <mod-cluster-config advertise="false" connector="ajp" proxy-list="host:6666">
    ...
  </mod-cluster-config>
</subsystem>

4) Start Apache.

5) Start JBoss EAP.

You can find more details in the Administration and Configuration Guide.

Published by:

Fernando Ribeiro

Experienced tech executive with a 24-year track record in enterprise computing. Leading AWS's professional services application modernization division in Brazil. He's held diverse roles including management, solutions architecture, sales consultancy, and full-stack development at major players like Oracle, Red Hat, and IBM. Fernando also contributes to open source and writes about emerging technologies. The views expressed here are his own and do not necessarily reflect the views of AWS.

Categories SoftwareTags , , , 1 Comment

One thought on “How to Setup Load Balancing in JBoss EAP 6 with mod_cluster”

  1. Very good article!!!
    But for the mod_cluster I had to run the command

    semanage port -a -t http_port_t -p udp 23364

    instead since the default advertising port for mod_cluster is the 23364 and the protocol is UDP.
    Otherwise I was getting the famous error during the startup of httpd:

    [error] (13)Permission denied: mod_advertise: ma_group_join apr_socket_bind failed
    [error] (13)Permission denied: mod_advertise: multicast join failed for 224.0.1.105:23364.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.