Mod cluster on JBoss AS 5.x


Download Files

Download all files, to build mod_cluster and mod_proxy_ajp

1.Download packages for Mod_cluster module version 1.1.1 :
2.Download library for Mod_cluster :
3.Reference Documentation for mod_cluster and how it works
  wget -c


Install mod_cluster
extract file mod_cluster-1.1.1.Final-bin.tar.gz
copy folder mod_cluster.sar to JBoss AS/server/node01/deploy or where the server node stored
configure file mod_cluster-jboss-beans.xml at mod_cluster.sar/META-INF add this following lines :
<bean name="HAModClusterConfig" class="org.jboss.modcluster.config.ha.HAModClusterConfig" mode="On Demand">
<property name="proxyList">${jboss.modcluster.proxyList:localhost:80}</property>
<property name="domain">${jboss.Domain:DefaultDomain}</property>
<property name="stickySession">true</property>
       <property name="stickySessionForce">true</property>
           <property name="stickySessionRemove">false</property>
               <property name="maxAttempts">1</property>
                   <property name="workerTimeout">-1</property>
                       <property name="balancer">${jboss.modcluster.balancer}</property>

Web Server

Install the Web Server for this you can use the native jboss web server you can download it at
extract and put it at /opt
Configure Web server Edit the http.conf and add the Virtual hosts for JBoss AS node if you want use a web server from
edit the configuration at /opt/jboss/httpd/httpd/conf
Unmark this line
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
then leave this native configuration we only need to remark the Advertise module, so we still can access the mod_cluster-manager from localhost
# Adjust to you hostname and subnet.
<IfModule manager_module>
  ManagerBalancerName mycluster
      <Location />
       Order deny,allow
       Deny from all
       Allow from 127.0.0
KeepAliveTimeout 300
  MaxKeepAliveRequests 0
  #ServerAdvertise on http://@IP@:6666
  #AdvertiseFrequency 5 ==> remark this line, so the Advertise modules will not conflict with the virtual host 
  #AdvertiseSecurityKey secret
  #AdvertiseGroup @ADVIP@:23364
      <Location /mcm>
        SetHandler mod_cluster-manager
        Order deny,allow
        #Deny from all
        Allow from 127.0.0
In this configuration modules is already loaded, and the *.so files is already at modules directory. next we need to configure the VirtualHost at
add this line:
<VirtualHost node01.asik.local:80> # change the node
 <Directory />
    Order deny,allow
    Allow from all
 <Location /mcm>
     SetHandler mod_cluster-manager
     Order deny,allow
     Allow from all
     Allow from 192.168
 KeepAliveTimeout 60
 MaxKeepAliveRequests 0
 ManagerBalancerName testcluster
 AdvertiseFrequency 5
<VirtualHost *:80>
 ServerAdmin admin@asik.local
 DocumentRoot /opt/jboss/httpd/htdocs/htdocs/node01.asik.local/data
 ServerName node01.asik.local:80                                        # change the node
 ErrorLog logs/node01.asik.local-error_log                              # change the node
 CustomLog logs/node01.asik.local-access_log combined                   # change the node
 LogLevel debug
 ProxyPass / balancer://cluster1/application1 stickysession=JSESSIONID|jsessionid nofailover=On
 ProxyPassReverse / balancer://cluster1/application1 #the application1 is a test aplication for cluster we will use it

Restart Web Server

Run the web server
#/opt/jboss/httpd/sbin/httpd -k start
#/opt/jboss/httpd/sbin/apachectl start

Build application tester

download the file at
extract and repack again with different name
jar xvf clusterjsp.war
jar cvf application1.war *
Put the application1.war at JBoss AS/server/deploy/ Run the JBoss AS
./bin/ -c node01 -g cluster1 -Djboss.messaging.ServerPeerID=1 -Djboss.service.binding.set=ports-default 
-Djboss.jvmRoute="node01" -Djboss.Domain=domain1 -Djboss.mod_cluster.proxyList="" 
-Djboss.modcluster.balancer="cluster1"  -Djboss.bind.address=""

Run application tester

open the mod_cluster-manager
< JBoss server fqdn / ip address >/mcm
open application tester
< JBoss server fqdn / ip address >/application1


Popular posts from this blog

authentication failure using SSH pam_unix(sshd:auth): authentication failure;

Howto configure SPLUNK Universal Forwarder

openvpn howto make OCSP server using OpenSSL [Part2]