One computer installs multiple tomcat server tutorials at the same time, window installs tomcat7, tomcat8, tomcat9 three server tutorials at the same time

Install multiple tomcat servers on one computer at the same time

. introduce

A. Explain why it is sometimes necessary to install multiple Tomcat servers at the same time.
Application isolation: When you need to run multiple independent applications on the same device, each application may need to use a different Tomcat configuration and environment. By installing multiple Tomcat servers at the same time, isolation between applications can be achieved to ensure that they do not interfere with each other. This isolation prevents problems in one application from affecting the operation of other applications.

Multiple application versions: Sometimes it may be necessary to run multiple versions of the same application on the same device, such as a development environment and a production environment. Each version may require different Tomcat configuration and dependencies. By installing multiple Tomcat servers at the same time, it is easy to manage and switch between different versions of the application.

Development and test environments: During software development and testing, it is often necessary to simulate multiple environments, such as development, test, and production environments. Each environment may require different configurations and settings. By installing multiple Tomcat servers at the same time, you can create an independent instance for each environment, and perform corresponding configurations in each instance to ensure the correct operation and testing of applications in different environments.

Load balancing and scalability: When an application needs to handle a large number of concurrent requests, installing multiple Tomcat servers at the same time can achieve load balancing and scalability. By distributing requests to different Tomcat instances, the performance and scalability of the system can be improved. This ensures that even under high load conditions, the system can still provide stable performance and response time.

Fault recovery and high availability: By installing multiple Tomcat servers at the same time, the fault tolerance and high availability of the system can be enhanced. If a Tomcat instance fails or needs maintenance, other Tomcat instances can still provide services to ensure system availability. This redundancy and backup mechanism reduces system downtime and provides better fault tolerance.

Installation process

The first step
is to download the tomcat version that needs to be installed. First, create a folder called tomcat on the D drive, and then put the downloaded tomcat version file in the tomcat folder, as shown in the figure below: just look at the first three folders.
insert image description here

The second step
is to set the environment variable. Before doing this, think about the port of each server. Such as tomcat open port 8075, tomcat open access port 8085, tomcat open port 8080

Then set the corresponding environment variables for the server according to this port. As shown below

insert image description here

The third step is to modify the content of the file with the suffix bat under the bin directory,

  1. Open the tomcatx.x.xx /bin directory and modify the content of the file with the suffix bat under the bin directory,
  2. Change the "CATALINA_HOME" and "CATALINA_BASE" characters in the bat file to the names of the environment variables configured in the second step. All the files circled by the red frame in the screenshot are changed. as follows:
  3. Change CATALINA_HOME in tomcat7 version to CATALINA_HOME_8075 Change CATALINA_BASE to CATALINA_BASE_8075 Follow this method
  4. Change CATALINA_HOME in tomcat8 version to CATALINA_HOME_8085 and CATALINA_BASE to CATALINA_BASE_8085
  5. tomcat9 just keep the default. If you want to modify it, just refer to the above two modifications.

insert image description here
The fourth step is to modify the server.xml file in the /conf directory

The tomcat9 version can remain the default without modification.
Modify the port number in the server.xml of the tomcat7 version (two places need to be modified) as shown in the figure below: the
first place
insert image description here
and the second place,
insert image description here
modify the port number in the server.xml of the tomcat 8 version in turn

Note for the first place
insert image description here
and the second place
insert image description here
: the port numbers of these two places cannot be the same! Do not use the same port number as other tomcat configurations!
The above is complete. Install 3 tomcat servers at the same time and set different ports. If you want to install more, you can continue to install other versions according to this method

Guess you like

Origin blog.csdn.net/hjjshua/article/details/130786420