Load Balancer
Step 1: Redirect the http requests by the use of “jk”
Create a new file jk.conf in the folder //conf. The loading of “jk.conf” must be added in Apache configuration file httpd.conf.
By this file, the order is given to Apache to load the module (mod_jk). It gives the location of the log file and its format, and selects the data in the URL that will be redirected to JBOSS (line JkMount
/configuratorUI/*).
Example of jk.conf:
# Load mod_jk module
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /etc/httpd/conf.d/workers.properties
# Where to put jk logs
JkLogFile /var/log/httpd/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 SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
# Send servlet for context
JkMount /cameleonResources/* loadbalancer
JkMount /cameleonUI/* loadbalancer
JkMount /catalogWS/* loadbalancer
JkMount /commonUI/* loadbalancer
JkMount /configuratorWS/* loadbalancer
JkMount /modelingUI/* loadbalancer
JkMount /eximpWS/* loadbalancer
JkMount /cart/* loadbalancer
JkMount /cartDesigner/* loadbalancer
JkMount /CWE/* loadbalancer
JkMount /CCS/* loadbalancer
JkMount /scheduler/* loadbalancer
Step 2: Add the Library “mod_jk.so” in Apache
Add the file mod_jk.so in the folder //modules.
The mod_jk.so is a library that is in charge of redirecting Apache to JBOSS/Tomcat.
Step 3: Register all the JBoss nodes and create the loadBalancer node
Create the new file workers.properties (that is referenced in your jk.conf file) in the folder /<apache directory>/conf.
This file defines:
- the « worker » in sense of JK = JBOSS,
- the communication protocol between Apache and JBOSS/Tomcat (ajp13),
- the host of JBOSS/Tomcat.
Example of workers.properties:
# Define the first node...
worker.node1.port=JBossAJPPort1
worker.node1.host=JBossIPAddress1
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.cachesize=10
# Define the second node…
worker.node2.port=JBossAJPPort2
worker.node2.host=JBossIPAddress2
worker.node2.type=ajp13
worker.node2.lbfactor=1
worker.node2.cachesize=10
# Now define the load-balancing behavior
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=node1,node2
worker.loadbalancer.sticky_session=1
# Define the status worker
worker.jkstatus.type=status
worker.list=loadbalancer,jkstatus
Step 4: Define the content of the configuration files for each of the nodes
The CPQ configuration files like cameleon.properties that are in folder /<cpq directory>/conf must be modified. In order to:
- Modify/replace the cameleon.url.public parameter to make it point to the Apache URL.
- The sharing context parameter has to be modified as follows:
- cart.sharedContext.externalMode=DB
Step 5: give a name to each of the JBoss nodes
The JBoss nodes parameterization is done via the file:
.. \jboss\standalone\configuration standalone-cameleon.xml
- Add a property in the system-properties section to identify the Apache worker node defined in the chapter 7.1.3.
<system-properties>…<property name="jvmRoute" value="node1"/>…</system-properties> - In the web subsystem, add the AJP connector
<subsystem xmlns="urn:jboss:domain:web:1.4" default-virtual-server="default-host" native="false">...<connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>...</subsystem>
Step 6: Test the result
Start all the nodes, access with several browsers to the application by using the application URL that is now http://IP_Of_APACHE/configuratorUI/…
All the nodes must be used to “load balance” the different users.
