Académique Documents
Professionnel Documents
Culture Documents
Kusal Gautamadasa
Version 1.2
8/16/2009
2 Load balancing with Apache and Jboss AS cluster
Tested envirnoment
• Jboss 4.2.3
• Apache HTTP 2.2
• Apache Tomcat Connectors 1.2.28 for WIN32
• Jdk 1.6 update 14
• Windows Xp SP 3
Aproach
Jboss Node A
/192.168.1.1
httpd.config \\Apache2.2\conf
mod_jk.so \\Apache2.2\modules
workers.properties
worker.list=loadbalancer,status
# Define Node1
3 Load balancing with Apache and Jboss AS cluster
# worker.node1.connection_pool_size=10 (1)
# Define Node2
# modify the host as your host IP or DNS name.
worker.nodeB.port=8009
worker.nodeB.host=192.168.1.2
worker.nodeB.type=ajp13
worker.nodeB.lbfactor=1
worker.nodeB.prepost_timeout=10000 #Not required if using ping_mode=A
worker.nodeB.connect_timeout=10000 #Not required if using ping_mode=A
# worker.node1.connection_pool_size=10 (1)
#worker.loadbalancer.sticky_session=1
worker.loadbalancer.balance_workers=nodeA,nodeB
uriworkermap.properties
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer
August 16, 2009
/hello/hello=loadbalancer
mod-jk.conf
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
httpd.config
# Include mod_jk configuration file
Include conf/mod-jk.conf
mod_jk.so:
Download the so file from the http://www.apache.org/dist/tomcat/tomcat-
connectors/jk/binaries/win32/jk-1.2.28/ and rename to mod_jk.so and move to apache module
directory.
JBoss Configuration
Server.xml : \server\all\deploy\jboss-web.deployer
Find line
For a example
AJP 1.3 connector port is 8009 and the default binding is localhost. If the node located in a
remote environment and required to access the web server jboss default binding should
change to “0.0.0.0” respectively. Afterward the node is transparent to the web server.
6 Load balancing with Apache and Jboss AS cluster
jboss-service.xml : \server\all\deploy\jboss-web.deployer\META-INF
<attribute name="UseJK">false</attribute>
<attribute name="UseJK">true</attribute>