Monday, March 15, 2010

Apache JBOSS integration

1) Download mod_jk module from
http://www.gtlib.gatech.edu/pub/apache/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.28/i586/

2) Copy mod_jk-1.2.28-httpd-2.2.X.so to /opt/apacheconf

3) Edit the httpd.conf and add the following line
Include /opt/apacheconf/mod-jk.conf

4) Create /opt/apacheconf/mod-jk.conf file with the following content
LoadModule jk_module /opt/apacheconf/mod_jk-1.2.28-httpd-2.2.X.so
JkWorkersFile /opt/apacheconf/workers.properties
JkLogFile /opt/apachelogs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
JkRequestLogFormat "%w %V %T"

JkMountFile /opt/apacheconf/uriworkermap.properties
JkShmFile /opt/apachelogs/jk.shm

<Location /jkstatus>
JkMount status
#Order deny,allow
#Deny from all
#Allow from 127.0.0.1
</Location>

5) Create /opt/apacheconf/uriworkermap.properties file with the following content
# Simple worker configuration file
# Mount the Servlet context to the ajp13 worker
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer
/testWeb/*=loadbalancer
!/testWeb/images/*=loadbalancer

6) Create /opt/apacheconf/workers.properties file with the following content
worker.list=loadbalancer,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host={jboss-server-ip-address goes here}
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
worker.node1.connect_timeout=10000 #Not required if using ping_mode=A
worker.node1.ping_mode=A #As of mod_jk 1.2.27
# worker.node1.connection_pool_size=10 (1)

# Define Node2
# modify the host as your host IP or DNS name.
#worker.node2.port=8009
#worker.node2.host= node2.mydomain.com
#worker.node2.type=ajp13
#worker.node2.lbfactor=1
#worker.node2.prepost_timeout=10000 #Not required if using ping_mode=A
#worker.node2.connect_timeout=10000 #Not required if using ping_mode=A
#worker.node2.ping_mode=A #As of mod_jk 1.2.27
# worker.node1.connection_pool_size=10 (1)

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

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

The above configuration is to test with one app server functionally.

7) Update /opt/apacheconf/httpd-vhosts.conf with JkMount
Listen 9080
NameVirtualHost *
<VirtualHost *>
ServerName {server-name}
ServerAlias {alias}
JkMount /testWeb loadbalancer
JkMount /testWeb/* loadbalancer
</VirtualHost>

8) Update the following line to include jvmRoute in /opt/jboss-eap-5.0/jboss-as/server/default/deploy/jbossweb.sar/server.xml

<Engine name="jboss.web" defaultHost="localhost" jvmRoute="domain-name-goes-here">

9) Restart Apache and JBOSS server

10) Test the web server URL http://{domain-name}/testWeb/test.jsp



0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Newer›  ‹Older