How to setup JBoss Apache mod_jk

This note provides typical setup steps for Jboss application server.

Initial setup

Install Java Install apache-ant (Just need to extract the zip)

Configure environment variable For example /root/.bash_profile

ANT_HOME=/opt/ant
PATH=/opt/java/bin:$ANT_HOME/bin:$PATH:$HOME/bin:./
JAVA_HOME=/opt/java
export JAVA_HOME
export PATH
export CLASSPATH=/usr/java/jdk/lib/tools.jar:/usr/java/jdk/jre/lib/rt.jar:./

Install jboss GA version
http://sourceforge.net/projects/jboss Unzip it at /opt directory
Configure environment variable
/root/.bash_profile
JBOSS_HOME=/opt/jboss
export JBOSS_HOME
Write init script to start
Startup
nohup /opt/jboss/bin/run.sh -b 0.0.0.0 &
Shutdown
opt/jboss/bin/shutdown -S
Install mod_jk for apache proxyinghttp://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linuxCopy mod_jk.so to /etc/httpd/modules
Edit httpd.config for mod_jk
vi /etc/httpd/conf/httpd.conf
Include conf/mod_jk.conf
Create /etc/httpd/conf/mod_jk.conf
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find worker.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 indicate to send SSK KEY SIZE
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"

# Mount your applications
JkMount /* loadbalancer

# Add shared memory
JkShmFile logs/jk.shm
Create /etc/httpd/conf/workers.properties
worker.list=worker1, worker2, loadbalancer, loadbalancerSSL, status

# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=192.168.1.21
worker.worker1.port=8009
worker.worker1.lbfactor=1
worker.worker1.connect_timeout=10000
#worker.worker1.prepost_timeout=10000
#worker.worker1.connection_pool_timeout=600
worker.worker1.socket_keepalive=False
#worker.worker1.socket_timeout=10

# Set properties for worker2 (ajp13)
worker.worker2.type=ajp13
worker.worker2.host=192.168.1.22
worker.worker2.port=8009
worker.worker2.lbfactor=1
worker.worker2.connect_timeout=10000
#worker.worker2.prepost_timeout=10000
#worker.worker2.connection_pool_timeout=600
worker.worker2.socket_keepalive=False
#worker.worker2.socket_timeout=10

# Set properties for worker(lb) which use worker1 and worker2
worker.loadbalancer.type=lb
worker.loadbalancer.sticky_session=1
worker.loadbalancer.balance_workers=worker2,worker1

worker.loadbalancerSSL.type=lb
worker.loadbalancerSSL.sticky_session=1
worker.loadbalancerSSL.balance_workers=worker2,worker1

# Status worker for managing load balancer
worker.status.type=status
Create file /etc/httpd/conf/uriworkermap.properties
/webapps1/*.do=loadbalancerSSL
/webapps2/*.jsp=loadbalancerSSL

Comments