I am trying to set up a JBoss Cluster with Apache Load Balancing. But when I type localhost
in my browser it should get redirected (proxied?) to port 8080 (JBoss) but it is not getting redirected.
Here's my environment setup:
Ubuntu 11.04
JBoss AS 5.1-GA
Apache 2
mod_jk 1.2.30
My setup looks something like the following:
Apache Web Server: 192.168.1.12:80 - lb1
JBoss App Server 1: 192.168.1.12:8080 - app1
JBoss App Server 2: 192.168.1.23:8080 - app2
My loadbalancer and JBoss1 is on the same machine. (I even tried keeping it on two different machines).
I have copied the mod_jk.so file into /usr/lib/apache2/modules/mod_jk.so, and executed the following steps:
- Now execute the following
# echo LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so" > /etc/apache2/mods-available/jk.load
- And
# touch /etc/apache2/mods-available/jk.conf
- And
# touch /etc/apache2/workers.conf
# a2enmod jk
I have created the file /etc/apache2/workers.conf
in the lb1 machine
# Defining the workers list:
worker.list=loadbalancer,status
# first worker properties, we use the AJB13 connection type:
worker.worker1.type=ajp13
worker.worker1.connection_pool_size=20
worker.worker1.host=192.168.1.12
worker.worker1.port=8080
worker.worker1.lbfactor=1
# second worker properties, we use the AJB13 connection type:
worker.worker2.type=ajp13
worker.worker2.connection_pool_size=20
worker.worker2.host=192.168.1.23
worker.worker2.port=8080
worker.worker2.lbfactor=1
# No we set the load balancing config
worker.loadbalancer.type=lb
worker.loadbalancer.sticky_session=true
worker.loadbalancer.balance_workers=worker1,worker2
worker.status.type=status
And I have created the file /etc/apache2/mods-available/jk.conf
:
<IfModule mod_jk.c>
# The Jk shared mem location
JkShmFile /var/log/apache2/mod_jk.shm
# Jk logs
JkLogFile /var/log/apache2/mod_jk.log
# Jk loglevel
JkLogLevel info
# Jk logformat
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Our workers config
JkWorkersFile /etc/apache2/workers.conf
# The most important:
# We will send eveything (/*) to our loadbalancer (set in JkWorkersFile)
JkMount /* loadbalancer
</IfModule>
I changed the serve.xml file of my JBoss:
<Connector port="8009" address="${jboss.bind.address}"
emptySessionPath="true" enableLookups="false" redirectPort="8443"
protocol="AJP/1.3" connectionTimeout="600000" maxThreads="200"/>
I checked the log files it says mod_jk is initialized.
But its not getting redirected to 8080 port of jboss.
Thanks in Advance.
This my mod_jk.log file
[Tue Jul 19 13:17:23 2011] [5505:3079493376] [info] init_jk::mod_jk.c (3183):
mod_jk/1.2.28 initialized
[Tue Jul 19 13:17:23 2011] [5506:3079493376] [info] init_jk::mod_jk.c (3183):
mod_jk/1.2.28 initialized
and error.log file of apache
[Tue Jul 19 13:17:23 2011] [notice] Apache/2.2.17 (Ubuntu) mod_jk/1.2.28 configured --
resuming normal operations
[Tue Jul 19 13:22:13 2011] [error] [client 192.168.1.12] File does not exist:
/var/www/favicon.ico