This article describes using the Mod_cluster component to load-balance jboss with Apache. The basic environment is: using jboss-eap-6.0 and Mod-cluster 1.2.6 under Linux RH6.3 64bit (integrated cluster of MOD APACHE,MOD_ related components cluster-1.2.6.final-linux2http-x64.tar.gz, you can download http://mod-cluster.jboss.org/downloads/1-2-6-Final-bin via the following connection from JBoss website).
For the Apache section, modify the configuration file by editing the/opt/jboss/httpd/httpd/conf/httpd.conf file:
</IfModule>
# Mod_cluster_adds
# Adjust to you hostname and subnet.
<ifmodule manager_module>
Listen 172.18.49.203:6666
# Managerbalancername Mycluster
managerbalancername Testcluster
<virtualhost 172.18.49.203:6666>
<location/>
Order Deny,allow
Deny from all
Allow from all
</Location>
KeepAliveTimeout 300
Maxkeepaliverequests 0
#ServerAdvertise on Http://@[email protected]:6666
Advertisefrequency 5
#AdvertiseSecurityKey Secret
Advertisegroup 224.0.1.106:23365
Serveradvertise on
Allowdisplay on
<Location/mod_cluster_manager>
SetHandler Mod_cluster-manager
Order Deny,allow
Deny from all
#Allow from 127.0.0
Allow from all
</Location>
</VirtualHost>
</IfModule>
Once the configuration file has been modified, start Apache by/opt/jboss/httpd/sbin/httpd-k start.The following indicatesApache started successfully.
jboss-eap-6.0 has integrated the MoD cluster. For the JBoss section, change the configuration file as follows.
To use mod cluster, you must use the Standalone-full-ha.xml or standalone-ha.xml file to configure JBoss.
<subsystem xmlns= "urn:jboss:domain:modcluster:1.1" >
<mod-cluster-config advertise-socket= "Modcluster" proxy-list= "172.18.49.203:6666" balancer= "TestCluster" Sticky-session= "true" connector= "AJP" >
<dynamic-load-provider>
<load-metric type= "busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
Where the balancer attribute needs to be consistent with Managerbalancername in Apache.
If there are other multicast addresses in the local area network, you will also need to change the following sections to the new multicast address, and the corresponding advertisegroup in Apache will be changed to the same address.
<socket-binding name= "Modcluster" port= "0" multicast-address= "224.0.1.106" multicast-port= "23365"/>
After you change the configuration, start JBoss, visit the Apache Mod_cluster_manager page, as shown below, indicating modcluster normal load.
JBoss via Apache Load Balancing Method II: Using Mod_cluster