Red Hat Training

A Red Hat training course is available for Red Hat JBoss Operations Network

32.7. Using the mod_cluster Services in EAP 6

The mod_cluster modules provides dynamic load balancing between web contexts on a JBoss application server and an Apache web server.
There are two halves to creating a cluster with mod_cluster: configuring the module on JBoss to manage the web applications and configuring the module on Apache to manage sessions and routing.
JBoss ON can manage the embedded mod_cluster subsystem for JBoss EAP 6 for both domain servers and standalone servers.

32.7.1. About mod_cluster and JBoss ON

The mod_cluster module, a subsystem on EAP 6, communicates between the web applications on a JBoss EAP server and an Apache web server. Multiple JBoss EAP servers can be involved in a mod_cluster group, and those servers can be managed servers, standalone servers, or a mix of both.

Figure 32.24. The mod_cluster Topology

The mod_cluster Topology
Only high availability profiles contain the mod_cluster module. For domains, the other-server-group server group is configured to use the full-ha profiles, though any profile which supports high availability can be used (such as the ha profile or a custom profile). For standalone servers, the server must be started with the standalone-ha.xml configuration.
One EAP server within the mod_cluster server is the master node; that is the administering mod_cluster service. Every other member of the cluster is a worker node.
Note
Information about mod_cluster in general is available with the mod_cluster project documentation.
Whether a specific resource belongs to the mod_cluster domain depends on the profile that resource is associated with, which is largely outside of the control of JBoss ON. (Of course, a standalone server can be started with the high availability configuration with the JAVA_OPTS settings in JBoss ON for start scripts, or a new managed server can be created that uses a high availability profile. But the profile definitions themselves are created and maintained outside of JBoss ON.)
JBoss ON manages the mod_cluster configuration itself. The cluster settings include multicast (advertising), load balancing, session handling, and network settings.

32.7.2. Configuring Multicast for Load Balancing

mod_cluster can use multicast signals to inform nodes which proxy servers are available. This allows nodes to register themselves automatically to the domain.
As a subset of the registration process, nodes can be directed to a specific domain or load balancer.
Note
Multicast is configured by default.
  1. Click the Inventory tab in the top menu.
  2. Select Servers - Top Level Imports in the Resources menu table on the left. Then select the JBoss EAP 6 server which hosts the mod_cluster service (the master node).
  3. Navigate to the mod_cluster service resource.
  4. Click the Configuration tab on the resource entry.
  5. Go to the Advertise Options section.
  6. Change the multicast settings.
    To use a specific load balancer for the mod_cluster nodes, set the Balancer field to the load balancer name and, optionally, the Domain field to the load balancer group, which is one of the groups configured on the balancer itself.
    Important
    The Balancer and Domain values must match the configuration for the corresponding Apache server.
  7. Click the Save button at the top of the page.

32.7.3. Excluding Web Contexts from Discovery

By default, any web context on a node is discovered and managed by the mod_cluster service. If a web context should not be included in the cluster, it can be excluded, by name.
  1. Click the Inventory tab in the top menu.
  2. Select Servers - Top Level Imports in the Resources menu table on the left. Then select the JBoss EAP 6 server which hosts the mod_cluster service (the master node).
  3. Navigate to the mod_cluster service resource.
  4. Click the Configuration tab on the resource entry.
  5. Go to the Web Context Options section.
  6. Unset the Excluded Contexts field, and add the names of any contexts to exclude.
    Note
    Some internal contexts for JBoss EAP are excluded by default. This should be kept in the excludes list; any new contexts to exclude should be added to the existing list.
  7. Click the Save button at the top of the page.

32.7.4. Configuring Web Context Metrics

mod_cluster can use different types of metrics to determine how to balance traffic most efficiently. These metrics are described in the mod_cluster documentation. These metrics include things like active sessions, request counts, and traffic.
Additionally, custom metrics can be written and added to the subsystem.
These metrics can be added to the mod_cluster subsystem configuration for JBoss ON to monitor (and existing metrics can be removed).
  1. Click the Inventory tab in the top menu.
  2. Select Servers - Top Level Imports in the Resources menu table on the left. Then select the JBoss EAP 6 server which hosts the mod_cluster service (the master node).
  3. Navigate to the mod_cluster service resource.
  4. Click the Operations tab on the resource entry.
  5. Select the Add (Custom) Metrics operation from the drop-down menu.
  6. Fill in the metric information. The default metrics are listed in the mod_cluster documentation.
  7. Click the Schedule button at the bottom of the page.