Configuration of multiple Tomcat7 running on a single CentOS host

Source: Internet
Author: User

Environment:

CentOS 6.5 x64

JDK8

apache-tomcat-7.0.70


1. Plan and configure the port:


Tomcat HTTP port, default 8080 AJP Port, default 8009 Remote Stop service port, default 8005
original apache-tomcat-7.0.70 71  <connector port= "8080 "  protocol= "http/1.1"
                    connectiontimeout= "20000"
                   redirectport= " 8443 "/>
   < Connector port= "8009 "  protocol= "ajp/1.3" redirectport= "8443"/> 22  <server port= "8005 " shutdown=" shutdown ";
Tomcat7-com-80 <connector port= "protocol=" http/1.1 "
connectiontimeout= "20000"
Redirectport= "8443" uriencoding= "UTF-8"/>
<connector port= "8030" protocol= "ajp/1.3" redirectport= "8443"/> <server port= "8006" shutdown= "Shutdown" >
tomcat7-ms-81 <connector port= "bayi" protocol= "http/1.1"
connectiontimeout= "20000"
Redirectport= "8443" uriencoding= "UTF-8"/>
<connector port= "8031" protocol= "ajp/1.3" redirectport= "8443"/> <server port= "8007" shutdown= "Shutdown" >
tomcat7-app-3800 <connector port= "3800" protocol= "http/1.1"
connectiontimeout= "20000"
Redirectport= "8443" uriencoding= "UTF-8"/>
<connector port= "8032" protocol= "ajp/1.3" redirectport= "8443"/> <server port= "8008" shutdown= "Shutdown" >


2. Download tomcat and unzip, empty the WebApps content, create a new root directory, and then modify the Server.xml content.


Under about 126 lines, add the app's configuration:

126 unpackwars= "true" autodeploy= "true" >


<context path= "" docbase= "ROOT" debug= "0" reloadable= "true" allowlinking= "true"/>

In this case, simply empty the WebApps directory, create a new root folder, and copy the app to the root folder.


3. Replication of three Tomcat servers

Cp-r apache-tomcat-7.0.70 tomcat7-com-80
Cp-r apache-tomcat-7.0.70 tomcat7-ms-81

Cp-r apache-tomcat-7.0.70 tomcat7-app-3800


4. Configure three Tomcat ports according to the plan.


5. Create a Tomcat environment settings script

Under Tomcat's Bin directory, create the setenv.sh file:

#add Tomcat PID

Catalina_pid= "$CATALINA _base/tomcat-ms-81. PID"

#add Java opts

Java_opts= "-server-xx:permsize=1024m-xx:maxpermsize=1024m-xss1024k-xms512m-xmx1024m-xx:maxnewsize=512m"

Note Modify the red PID name, the above parameters mean the following:


-XMS JVM initializing heap memory size

-XMX maximum memory for JVM heap

-XSS Thread Stack size

-xx:permsize JVM Initial memory allocation size for non-heap areas

-xx:maxpermsize JVM non-heap maximum memory


6. Deploy the app and start Tomcat in turn, with the following script:

/usr/local/hmg/tomcat7-com-80/bin/shutdown.sh/usr/local/hmg/tomcat7-ms-81/bin/shutdown.sh/usr/local/hmg/ tomcat7-app-3800/bin/shutdown.sh/usr/local/hmg/tomcat7-com-80/bin/startup.sh/usr/local/hmg/tomcat7-ms-81/bin/ startup.sh/usr/local/hmg/tomcat7-app-3800/bin/startup.sh


This article from the "Lava" blog, reproduced please contact the author!

Configuration of multiple Tomcat7 running on a single CentOS host

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.