[Tomcat] Use Catalina_base to deploy multiple tomcat instances

background

  1. On one machine, if you want to deploy multiple tomcat instances, but don't want to install multiple tomcats, you can use tomcat's Catalina_base to implement shared class libraries and bin commands, as long as you customize your own configuration.

  2. About CATALINA_HOME and CATALINA_BASE official explanation:

CATALINA_HOME: indicates the root directory of the Tomcat installation, such as /home/tomcat/apache-tomcat-9.0.10 or C:\Program Files\apache-tomcat-9.0.10.
CATALINA_BASE: Represents the root of the runtime configuration of a specific Tomcat instance. If you want to have multiple Tomcat instances on one computer, use the CATALINA_BASE attribute.
If you set the property to another location, the CATALINA_HOME location contains static sources, such as .jar files or binary files. The CATALINA_BASE location contains configuration files, log files, deployed applications and other runtime requirements.

begin

  1. Download tomcat and unzip it to D:\Program Files\apache-tomcat-9.0.0.M20

     

  2. Create two new instance directories under D:\workspace\tomcat

     

     

  3. Copy the apache-tomcat-9.0.0.M20 directory file to the instance directory 1

     

  4. Modify the server.xml configuration under the conf of instance 1

Server port="8015" 修改为8115
Connector port="8080" 修改为8070
Connector port="8009" 修改为8109

   5. Create a new startup.bat file in the root directory of instance 1

set "CATALINA_BASE=%cd%"
set "CATALINA_HOME=D:\Program Files\apache-tomcat-9.0.0.M20"
set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat"
  
call "%EXECUTABLE%" start 
  • CATALINA_BASE=%cd%
    Specify the directory of CATALINA_BASE as D:\workspace\tomcat\tomcat9-ins1

  • CATALINA_HOME=D:\Program Files\apache-tomcat-9.0.0.M20
    Specify the CATALINA_HOME directory as D:\Program Files\apache-tomcat-9.0.0.M20

  • set "EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat" call "%EXECUTABLE%" start
    Indicates to start tomcat with the configuration information of the current directory

Repeat the above steps in the tomcat9-ins2 directory

verification

  1. Execute startup.bat of tomcat9-ins1

     

  2. Execute startup.bat of tomcat9-ins2

Finished

Guess you like

Origin blog.csdn.net/xiaokanfuchen86/article/details/114636908