Chapter 5. Configuration example for load-balancing with mod_cluster
You can configure JBoss Core Services to use the mod_cluster connector for load-balancing in a Red Hat Enterprise Linux system.
When you want to configure a load-balancing solution that uses mod_cluster, you must perform the following tasks:
5.1. Setting up JBoss Core Services as a proxy server Copy linkLink copied to clipboard!
When you configure JBoss Core Services to use mod_cluster, you must set up JBoss Core Services as a proxy server by specifying configuration details in the mod_cluster.conf file.
Procedure
-
Go to the
JBCS_HOME/httpd/conf.d/directory. -
Create a file named
mod_cluster.conf. Enter the following configuration details:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe preceding example shows how to set up JBoss Core Services as a proxy server that is listening on
localhost.
5.2. Configuring a Tomcat worker node Copy linkLink copied to clipboard!
When you configure JBoss Core Services to use mod_cluster, you must configure a Tomcat worker node by adding a Listener element to the server.xml file.
Prerequisites
Procedure
-
Open the
JWS_HOME/tomcat<VERSION>/conf/server.xmlfile. Add the following
Listenerelement:<Listener className="org.jboss.modcluster.container.catalina.standalone.ModClusterListener" advertise="true"/>
<Listener className="org.jboss.modcluster.container.catalina.standalone.ModClusterListener" advertise="true"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.3. Defining iptables firewall rules example Copy linkLink copied to clipboard!
When you configure JBoss Core Services to use mod_cluster, you must define firewall rules by using iptables.
Prerequisites
- You have configured a Tomcat worker node.
Procedure
Use
iptablesto define a set of firewall rules.For example:
/sbin/iptables -I INPUT 5 -p udp -d 224.0.1.0/24 -j ACCEPT -m comment --comment "mod_cluster traffic" /sbin/iptables -I INPUT 6 -p udp -d 224.0.0.0/4 -j ACCEPT -m comment --comment "JBoss Cluster traffic" /sbin/iptables -I INPUT 9 -p udp -s 192.168.1.0/24 -j ACCEPT -m comment --comment "cluster subnet for inter-node communication" /sbin/iptables -I INPUT 10 -p tcp -s 192.168.1.0/24 -j ACCEPT -m comment --comment "cluster subnet for inter-node communication" /etc/init.d/iptables save
/sbin/iptables -I INPUT 5 -p udp -d 224.0.1.0/24 -j ACCEPT -m comment --comment "mod_cluster traffic" /sbin/iptables -I INPUT 6 -p udp -d 224.0.0.0/4 -j ACCEPT -m comment --comment "JBoss Cluster traffic" /sbin/iptables -I INPUT 9 -p udp -s 192.168.1.0/24 -j ACCEPT -m comment --comment "cluster subnet for inter-node communication" /sbin/iptables -I INPUT 10 -p tcp -s 192.168.1.0/24 -j ACCEPT -m comment --comment "cluster subnet for inter-node communication" /etc/init.d/iptables saveCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe preceding example shows to define firewall rules for a cluster node on the
192.168.1.0/24subnet.