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