Jboss cluster Archive

Configure Apache WebServer with Jboss cluster.

1:- Create a cluster of Jboss server instances.

a:- Copy the folder ’all’ under the server directory i.e. the location JBOSS_HOME

b:- Rename it as Noode1 and Node2 which would be acting as the two Jboss instances within the cluster.

c: – Go to the command prompt and navigate to the bin folder under the JBOSS_HOME.

d: – Run both the server instances by specifying the below command.

For Node1:-
run.bat -c Node1 -g QACluster -u -b abc.com

For Node2:-
run.bat -c Node2 -g QACluster -u -b xyz.com

-c refers to the node1 that is the part of the cluster
-g refers to the name of the cluster
-u refers to the multicast address
-b refers to the bind address of the node server.
-Djboss.service.binding.set refers to the ports of the Node1

2:- Copy the mod_jk.so file to the modules directory of the Apache Server.

3:- Copy the mod-jk.conf to the conf directory of the Apache server installation.

A sample mod-jk.conf would look like this.


# Load mod_jk module

# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile conf/workers.properties

# Where to put jk logs
JkLogFile logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel info

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicates to send SSK KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"

# Mount your applications
JkMount /* loadbalancer

# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer
# JkMountFile conf/uriworkermap.properties

# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for

# for load balancing to work properly
JkShmFile logs/jk.shm

# Add jkstatus for managing runtime data

JkMount status
Order allow,deny
#Deny from all
Allow from all




Check the LoadModule tag for the proper location of the mod_jk.so module.
Check the JkWorkersFile tag for the proper location of the workers.properties file.

4: Provide an entry for the mod_jk.conf file in the httpd.conf like below.
Include conf/mod-jk.conf

5:- Copy the workers.properties file to the Conf directory of the Apache installation directory.

A sample works.properties file look like this.



# Define list of workers that will be used
# for mapping requests

# Define Node1
# modify the host as your host IP or DNS name.

# Define Node2
# modify the host as your host IP or DNS name.

# Load-balancing behavior

# Status worker for managing load balancer



Note: – worker.node1.port contains the ajp13 port for the node1, which is 8009 for default.

You can check the corresponding value from bindings.xml file under conf/bootstrap

6:- Deploy the sample application on both the nodes.

For Jboss 5.1 and above, just place the application war file under the farm directory of any of the nodes and that would automatically gets propagated to the other nodes in the cluster.

For Jboss 5.0 and below, you need to copy the application war file manually to the deploy folder of each nodes in the cluster.

7:- Now, re-start the apache web server and check the below messages in the Jboss server logs to see whether the servers have joined the clusters or not.


14:28:24,343 INFO [GroupMember] I am (abc.com:3750)
14:28:24,343 INFO [GroupMember] New Members : 1 ([xyz.com:3812])
14:28:24,343 INFO [GroupMember] All Members : 2 ([abc.com:3750, xyz.com:3812])


8:- Now access the application deployed on the cluster using the below URL.