Linux Articles

How To Configure Multiple Tomcat Instances

 

                                                                   How To Configure Multiple Tomcat Instances

Description:

In developer environment user cannot test the one application in single Tomcat instances.So user need two instances in single server.Here is the steps how to install and use multiple Tomcat Instances in Linux server.

Steps:

– Need to download Tomcat 6 version from the below URL,

wget http://tomcat.apache.org/download-60.cgi

– Now extract the same file in two folders.

/opt/tomcat01
/opt/tamcat02

How To Configure Multiple Tomcat Instnaces01
– Open tomcat02 and change the below settings,we have to change the port number as mention here.

nano /opt/tomcat02/conf/server.xml

<server port=”8105″ shutdown=”SHUTDOWN”>
      …..
     <Connector port=”8181″ protocol=”HTTP/1.1″
      connectionTimeout=”20000″
      redirectPort=”8443″ />
      …..
     <Connector port=”8109″ protocol=”AJP/1.3″ redirectPort=”8443″ />

– Have to create script for tomcat01,tamcat02 to run as service,

01. write as below in /etc/init.d/tomcat01

#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/lib/jvm/jre-openjdk
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/opt/tomcat01

case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0

02. write as below in /etc/init.d/tomcat02

#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/usr/lib/jvm/jre-openjdk
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/opt/tomcat02

case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sh $CATALINA_HOME/bin/shutdown.sh
sh $CATALINA_HOME/bin/startup.sh
;;
esac
exit 0

– Restart the service using below commands,

Service tomcat01 start/stop/restart
         Service tomcat02 start/stop/restart

– Add Tomcat service in the start file chkconfig,

chkconfig tomcat01 on
    chkconfig tomcat02 on

Tags:tomcat,Multiple Tomcat,Tomcat Installation,Tomcat in windows,Tomcat in Linux,Tomcat services,Tomcat configuration,Tomcat version,Tech Articles,Hosting Articles,Knowledge Articles.

About the author

admin

1 Comment

Click here to post a comment

  • Hello, I am doing a project where I have to deploy multiple tomcat instances, for a Selenium based software testing project. I am really confused, why exactly do I need multiple instances, I can access all my applications with different URLS of localhost. Can someone explain this to me?

    Some help will be Much appreciated!