Monday, 27 June 2011

Instruction to set up Apache and tomcat for clustering


1) Install Apache in your system.

2) Install tomcat in your system and install the Saas application. Create one or more application. All tomcat folder should be placed in same path in all system. Eg c:/tomcat in sys1 and c:/tomcat in sys2.

3) Copy the tomcat folder and paste it in different system or in same system.

4) To run one jack rabbit for all tomcat application change the odicx database config table JCR_URL Value as http://[system ip address]/jackrabbit-webapp-2.1.0/rmi. Eg http:///jackrabbit-webapp-2.1.0/rmi

5) To configure Apache web server in your system with 2 or more tomcat
**********************************************************
Go to %Apache_home%/conf

I. Open httpd.conf
· Add line
LoadModule jk_module modules/mod_jk.so below 'LoadModule ...'

· Add lines
JKWorkersFile "conf/workers.properties"
JKLogFile "logs/mod_jk.log"
JKLogLevel info

· Below the 'LoadModule jk_module modules/mod_jk.so'
add line JkMount /* loadbalancer

II. Create a file called workers.properties and include the lines as given in Appendix I.

6) Download jk connector(mod_jk-X.X.X-httpd-X.X.X.so) from tomcat website (http://mirror.olnevhost.net/pub/apache/tomcat/tomcat-connectors/jk/binaries/) depending on the apache and tomcat config. Rename the so file to mod_jk.so and place it in %Apache_home%/modules.

7) Open %tomcat_home%/conf/server.xml

I. Change port number in the line to or any other number.

II. Change the AJP13 port to or any other number. This number should be given in the worker.properties file.

III. Remove/Disable the standalone HTTP port
We don't want or need our tomcat servers to directly respond to HTTP requests. So we comment out the HttpConnector section in the server.xml file if any given in the file.



NOTE:
If you don't comment this out, you will need to change the port numbers so they don't conflict between tomcat instances.

IV. Remove/Disable the WARP connector, if found in your server.xml file.
Comment out the tag.

Example:




NOTE:
o You might want to comment out the entire element. If so, make sure and remove the comments within it - XML doesn't like comments within comments.
o Do not forget to do the same thing to all the tomcat server.xml files.

V. Include the database config and user config in %tomcat_home%/context.xml.

lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat1.lbfactor=100


# ------------------------
# Second tomcat server
# ------------------------
# port number setted up in %tomcat_home%/conf/server.xml for this tomcat
worker.tomcat2.port=12009
# ip address of the system which has the tomcat in it
# eg worker.tomcat1.host=
worker.tomcat2.host=[system ip]
worker.tomcat2.type=ajp13

# Specify the size of the open connection cache.
worker.tomcat2.cachesize

#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat2.lbfactor=100


# ------------------------
# Thrid tomcat server
# ------------------------
# port number setted up in %tomcat_home%/conf/server.xml for this tomcat
worker.tomcat3.port=13009
# ip address of the system which has the tomcat in it
# eg worker.tomcat1.host=
worker.tomcat3.host=[system ip]
worker.tomcat3.type=ajp13

# Specify the size of the open connection cache.
worker.tomcat3.cachesize

#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat3.lbfactor=100


# ------------------------
# Load Balancer worker
# ------------------------

#
# The loadbalancer (type lb) worker performs weighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# worker.
worker.loadbalancer.type=lb
# add the number of workers defined at the top
worker.loadbalancer.balanced_workers=tomcat1, tomcat2, tomcat3

#
# END workers.properties
#
#--------------------------------------------------------


Appendix II





















No comments:

Post a Comment