OS: Linux Redhat
Load Balancer: Apache 2 (assuming it is in /usr/local/apache2)
App Server: JBoss 4x
What to do in Apache?
You need to install mod jk module in it, if not already present.
Look inside /usr/local/apache2/modules dir, if there is any file with name similar to mod_jk*.so
And rename it to mod_jk.so and add to:
You will be dealing with following config files typically:
- conf/httpd.conf – you will update it with mod jk related entries
- conf/workers.properties – you define where load balancing workers, ports and config here.
- conf/mod-jk.properties – you define jk properties here.
- conf/uriworkermap.prroperties – here you map the URL to ‘loadbalancer’ worker
The contents of the file typically are:
Modify conf/httpd.conf so that it contains the following line:
LoadModule jk_module modules/mod_jk.so
Contents of workers.properties file are:
Add conf/uriworkermap.properties: (this maps the URI with the ‘loadbancer’ worker mentioned in workers.properties file)
What to do in JBoss?
We will need at least two JBoss installations. If both are on same machine, then their ports must be different, if they are on different machines, then ports can remain same ofcourse.
Usually there is nothing to do in JBoss, since all the necessary ports are pre-configured. But you can check nevertheless.
The main thing here is to know – what the JBoss JK Port is. This is configured in bindings xml file. By default the bindings file is this one:
Typically, if JBoss http port is 8180, JK Port is 8109 (i.e HTTPPort-71, that’s what the calculation usually is!!)
This JKPort is what we provide in workers.properties file mentioned before. Thats it.
You can see that your requests are going to both the JBoss Servers.