Linux configure multiple Tomcat

Sometimes, the application is not convenient to use on one Tomcat, but multiple Tomcats need to be configured on the server. What should I do at this time? Write down my method of configuring multiple Tomcats below.


1. Add Tomcat environment variables

vim ~/.bashrc (here is the current user environment variable)

export CATALINA_HOME_EXCUTOR=/home/qiuzf/qiuzhenfei/apache-tomcat-excutor
export CATALINA_HOME_TASK_QUENE=/home/qiuzf/qiuzhenfei/apache-tomcat-task-quene
export CATALINA_HOME_TAG=/home/qiuzf/qiuzhenfei/apache-tomcat-8.5.5
export PATH=$PATH:$CATALINA_HOME_TASK_QUENE/bin:$CATALINA_HOME_TASK_QUENE/bin:$CATALINA_HOME_TAG/bin


2. Modify the startup port and shutdown port

vim conf/server.xml

Edit the communication port (change it to be different from other Tomcat's)

<!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="14000" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />


Edited to close the port (search for SHUTDOWN ) (changed to be different from other Tomcat's)

<Server port="14001" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->


3. Modify catalina.sh

vim bin/catalina.sh

Find the following, add CATALINA_BASE and CATALINA_HOME

# OS specific support.  $var _must_ be set to either true or false.
export CATALINA_BASE=$CATALINA_HOME_EXCUTOR
export CATALINA_HOME=$CATALINA_HOME_EXCUTOR

cygwin=false
darwin=false
os400=false
hpux=false


OK, get these, you can, you can start multiple Tomcat

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325490539&siteId=291194637