Jboss Clustering Steps For Apache

Make Sure all below given settings  are available in Apache configurations:

Apache WebServer Configurations Required:
——————————————————
Make Sure all below configurations are present in files present at <APACHE_HOME>/conf directory.
If not present then add them.

1. httpd.conf:
-----------------------------------
# Include mod_jk's specific configuration file
Include conf/mod-jk.conf

2. mod-jk.conf:
---------------------------------
# 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 /myapp/* loadbalancer
JkMount /jspellhtml2k4/* loadbalancer
JkMount /jspelliframe2k4/* loadbalancer
JkMount /jspellhtml2k4 loadbalancer
JkMount /jspelliframe2k4 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
# Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
JkShmFile run/jk.shm

# Add jkstatus for managing runtime data
<Location /jkstatus>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>

2. uriworkermap.properties
-------------------------------------------------
# Simple worker configuration file
# Mount the Servlet context to the ajp13 worker
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer
/myapp/*=loadbalancer
/myapp=loadbalancer
/jspellhtml2k4/*=loadbalancer
/jspellhtml2k4=loadbalancer
/jspelliframe2k4/*=loadbalancer
/jspelliframe2k4=loadbalancer

3. workers.properties
-------------------------------------------------
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
#
worker.list=loadbalancer,status

# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=myapp-myapp.myapp.com
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.connection_pool_size=10
worker.node1.cachesize=10

# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.port=8009
worker.node2.host=myapp-myapp1.myapp.com
worker.node2.type=ajp13
worker.node2.lbfactor=1
worker.node2.connection_pool_size=10
worker.node2.cachesize=10

# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.sticky_session=1

# Status worker for managing load balancer
worker.status.type=status

2.    Make Sure all below given settings are available in JBoss configurations in all nodes of  Jboss cluster.

JBoss Server Side Configuration Changes:
———————————————–

1. Remove/comment out below two ports from jacorb.properties file.
----------------------------------------------------------------------
vi /opt/jboss/jboss-eap-4.3.0.GA_CP06/jboss-as/server/template_cluster/conf/jacorb.properties
Search for below two lines
OAPort=3528
OASSLPort=3529
Commentout both lines like below and save the file.
#OAPort=3528
#OASSLPort=3529

2. Add jvmRoute
------------------
vi /opt/jboss/jboss-eap-4.3.0.GA_CP06/jboss-as/server/template_cluster/deploy/jboss-web.deployer/server.xml

Search For Below Text:
<Engine name="jboss.web" defaultHost="localhost">
Change it to:
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">

Note: This configuration needs to be done in all the nodes and all the configuration files need to be changed accordingly.
Check the workers.properties file to know which host is node1 or nodex
Example: For node2 the jvmRoute will be node2(HostName can be found out from workers.properties file)
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node2">

3. Change UseJK to true
-------------------------
vi /opt/jboss/jboss-eap-4.3.0.GA_CP06/jboss-as/server/template_cluster/deploy/jboss-web.deployer/META-INF/jboss-service.xml

Search For Below Text:
<attribute name="UseJK">false</attribute>
Change it to:
<attribute name="UseJK">true</attribute>

Note: This configuration needs to be done in all the nodes and all the configuration files need to be changed accordingly.

4. Make Sure Below properties are present in jboss-service.xml config file.
------------------------------------------------------------------------------
vi /opt/jboss/jboss-eap-4.3.0.GA_CP06/jboss-as/server/template_cluster/deploy/jboss-web-cluster.sar/META-INF/jboss-service.xml

<mbean code="org.jboss.cache.aop.TreeCacheAop" name="jboss.cache:service=TomcatClusteringCache">
<depends>jboss:service=Naming</depends>
<depends>jboss:service=TransactionManager</depends>
<depends>jboss.aop:service=AspectDeployer</depends>
<attribute name="TransactionManagerLookupClass">org.jboss.cache.BatchModeTransactionManagerLookup</attribute>
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
<attribute name="CacheMode">REPL_ASYNC</attribute>
<attribute name="ClusterName">Tomcat-${jboss.partition.name:Cluster}</attribute>
<attribute name="UseMarshalling">false</attribute>
<attribute name="InactiveOnStartup">false</attribute>
<attribute name="ClusterConfig">
... ...
</attribute>
<attribute name="LockAcquisitionTimeout">15000</attribute>
</mbean>

----------------------------------------------------------------------------------------------------------------------------

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.