0% found this document useful (0 votes)
90 views

Tomcat

This document provides instructions for installing and configuring Tomcat, Apache HTTP Server, and mod_jk to load balance Tomcat instances. The steps include downloading and extracting Tomcat, configuring environment variables, starting Tomcat, setting up user accounts, enabling compression in Tomcat, configuring mod_jk in Apache HTTP Server to route requests to multiple Tomcat instances defined as workers, and configuring the Tomcat connectors.

Uploaded by

Prashanth Sagar
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

Tomcat

This document provides instructions for installing and configuring Tomcat, Apache HTTP Server, and mod_jk to load balance Tomcat instances. The steps include downloading and extracting Tomcat, configuring environment variables, starting Tomcat, setting up user accounts, enabling compression in Tomcat, configuring mod_jk in Apache HTTP Server to route requests to multiple Tomcat instances defined as workers, and configuring the Tomcat connectors.

Uploaded by

Prashanth Sagar
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 11

Installation Of Tomcat

1.Download Apache Tomcat archive file from Apache tomcat official


download page http://tomcat.apache.org/downloads
2. After competed download extract archive file in /home directory. You may
change this location as per your requirements
# tar xvf apache-tomcat-7.0.54.tar.gz
3. Setup JAVA_HOME and PATH environment in .bash_profile
JAVA_HOME=/usr/java/jdk1.7.0_60
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
export PATH JAVA_HOME
4. Go to bin directory of tomcat and start the server using below command
#startup.sh
5. Access the Tomcat on web browser by connecting server on port 8080

6. Set up the user account

we need to create user accounts to secure and access admin/manager


pages. Edit conf/tomcat-users.xml file in your editor and paste inside
<tomcat-users> </tomcat-users> tags.
<role rolename="manager_gui"/>
<user username="admin" password="admin123" roles="manager-gui"/>
<role rolename="admin_gui"/>
<user username="admin" password="admin123" roles="admin-gui"/

Compression In Tomcat
Go to tomcat->conf->server.xml and add the below lines
<Connector port="8010" protocol="HTTP/1.1" address="10.96.124.92"
connectionTimeout="20000"
redirectPort="8443"
compression="on"
compressionMinsize="1024"
noCompressionUserAgents="gozilla,traviata"
compressableMimeType="text/html,text/xml"/>

Mod_jk configuration in Apache Webserver


a) Add the below line in httpd.conf file which is under /etc/httpd/conf.d
Include conf/mod_jk.conf
b) Create the file mod-jk.conf under /etc/httpd/conf.d and add the below lines:

LoadModule jk_module modules/mod_jk.so


JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile logs/jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T %U %R"
JkshmFile logs/jk.shm
<VirtualHost 10.96.124.194:80>
ServerName www.mrc.gov.in
#JkMount /* loadbalancer
JkMount /sakala* loadbalancer3
JkMount /CMSMTDP* loadbalancer
JkMount /SFC* worker11
JkMount /CorpGrant* loadbalancer
JkMount /ams* loadbalancer4
#JkMount /egbnd* loadbalancer2
JkMount /jalanidhi* loadbalancer1
JkMount /akm* worker8
JkMount /MIB* worker14
JkMount /OVP* worker21
JkMount /PDL* worker22

JkMount /ISHUP* worker3


JkMount /SWIR* worker17
JkMount /slrum* worker15
#JkMount /*.jsp loadbalancer
JkMount /services/* loadbalancer
JkMount /SLB* worker26
JkMount /KMRPBD* worker27
JkMount /ptis-report* worker27
JkMount /MRCPTIS* worker27
JkMount /PTaxReport* worker27
JkMount /streetvendor* worker39
</VirtualHost>
Similary for all 213 websites with particular virtual host
c) Create workers.properties file under /etc/httpd/conf and add the below
lines:
# Define list of workers that will be used
# for mapping requests

worker.list=loadbalancer2,loadbalancer,loadbalancer3,loadbalancer4,loadbal
ancer1,worker3,worker8,worker11,worker14,worker15,worker16,worker17,wo
rker18,worker19,worker20,worker21,worker22,worker23,worker25,worker26,
worker27,worker28,worker39,loadbalancerpgrulb,loadbalancerpgrcorp,loadb
alancerptax,loadbalancerptis,loadbalancerfbas,jkstatus

##########################STATUS################
###
# Included to monitor load
worker.jkstatus.type=status

################CMSMTDP,SAKALA,CORGRANT,AMS#########
#######
####################### CORPGRANT,CMSMTDP
#################
worker.worker1.reference=worker.template
worker.worker1.host=10.96.124.92
worker.worker1.port=8009

worker.worker13.reference=worker.template
worker.worker13.host=10.96.124.93
worker.worker13.port=8009

worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=worker1,worker13
worker.loadbalancer.sticky_session=True

#####################
Sakala#############################
worker.worker9.reference=worker.template
worker.worker9.host=10.96.124.92
worker.worker9.port=8209
worker.worker12.reference=worker.template

worker.worker12.host=10.96.124.93
worker.worker12.port=8209

worker.loadbalancer3.type=lb
worker.loadbalancer3.balance_workers=worker9
worker.loadbalancer3.sticky_session=True

##########################
AMS#############################
worker.worker10.reference=worker.template
worker.worker10.host=10.96.124.92
worker.worker10.port=8309

worker.worker2.reference=worker.template
worker.worker2.host=10.96.124.93
worker.worker2.port=8309

worker.loadbalancer4.type=lb
worker.loadbalancer4.balance_workers=worker2,worker10
worker.loadbalancer4.sticky_session=True

#########################ISHUP,MIS,PIS,SWIR#########
###########
###################### ISHUP
###############################
worker.worker3.reference=worker.template
worker.worker3.host=10.96.124.94

worker.worker3.port=8310

##################### SWIR
##############################
worker.worker17.reference=worker.template
worker.worker17.host=10.96.124.94
worker.worker17.port=8320

##################### PIS (pinsdma)


####################
worker.worker18.reference=worker.template
worker.worker18.host=10.96.124.94
worker.worker18.port=8330

#################### MIS (FormAdma)


################
worker.worker19.reference=worker.template
worker.worker19.host=10.96.124.94
worker.worker19.port=8340

####################### AKM
##############################
worker.worker8.reference=worker.template
worker.worker8.host=10.96.124.97
worker.worker8.port=8009

##################### OVP
#################################
worker.worker21.reference=worker.template
worker.worker21.host=10.96.124.97
worker.worker21.port=8010

#################### STREET VENDOR


#########################
worker.worker39.reference=worker.template
worker.worker39.host=10.96.124.117
worker.worker39.port=8009

##################### PDL
###############################
worker.worker22.reference=worker.template
worker.worker22.host=10.96.124.97
worker.worker22.port=8011

###################### SJSRY
############################
worker.worker23.reference=worker.template
worker.worker23.host=10.96.124.97
worker.worker23.port=8012

###################### SFC
################################
worker.worker11.reference=worker.template

worker.worker11.host=10.96.124.95
worker.worker11.port=8109

####################### MIB
#######################
worker.worker14.reference=worker.template
worker.worker14.host=10.96.124.95
worker.worker14.port=8209

#########################SLRUM#################
###########
worker.worker15.reference=worker.template
worker.worker15.host=10.96.124.95
worker.worker15.port=8309

#######################GOISLB###################
###########
worker.worker16.reference=worker.template
worker.worker16.host=10.96.124.95
worker.worker16.port=8409

####################### PTAX
CALC##########################
worker.worker25.reference=worker.template
worker.worker25.host=10.96.124.96
worker.worker25.port=8809

####################### GOK SLB


###########################
worker.worker26.reference=worker.template
worker.worker26.host=10.96.124.96
worker.worker26.port=8709

##################### PTIS
Reports#############################
worker.worker27.reference=worker.template
worker.worker27.host=10.96.124.96
worker.worker27.port=8909

####################### Mysore Property Tax


Calculator###############
worker.worker28.reference=worker.template
worker.worker28.host=10.96.124.96
worker.worker28.port=8609

Mod_jk configuration in Tomcat

In server.xml add below line


<Connector port="8010" protocol="HTTP/1.1" address="10.96.124.92"

<!-- Define an AJP 1.3 Connector on port 8009 -->


<Engine name="Catalina" defaultHost="localhost" jvmRoute="worker1">

Note: add the particular vm ip in address= and specify the jvmRoute for
each VM

You might also like