In Linux, how does one configure multiple Tomcat to run simultaneously? First, change the variable to the First tomcat, and then modify the script started by the second tomcat.
How to start multiple Tomcat servers in the same system at the same time
Vi/etc/profile
Add
########## First tomcat ###########
CATALINA_BASE =/usr/local/tomcat
CATALINA_HOME =/usr/local/tomcat
TOMCAT_HOME =/usr/local/tomcat
Export CATALINA_BASE CATALINA_HOME TOMCAT_HOME
########## First tomcat ############
########## Second tomcat ##########
CATALINA_2_BASE =/usr/local/tomcat_2
CATALINA_2_HOME =/usr/local/tomcat_2
TOMCAT_2_HOME =/usr/local/tomcat_2
Export CATALINA_2_BASE CATALINA_2_HOME TOMCAT_2_HOME
########## Second tomcat ##########
Save and exit.
# Source/etc/profile
Go to the bin directory of the second tomcat
Add in catalina. sh
Export JAVA_HOME =
Export PATH =
Export CLASSPATH =
### The preceding three environment variables are JAVA environment variables that can be left empty ###
Export CATALINA_BASE = $ CATALINA_2_BASE
Export CATALINA_HOME = $ CATALINA_2_HOME
Finally, Open server. xml in tomcat_2/conf.
Modify the shudown port and start port. In this way, two tomcat servers can be run simultaneously in linux. Running more tomcat methods is the same.
The main point is that tomcat will search for the tomat root directory at startup, which is done by querying the system environment variables CATALINA_HOME and CATALINA_BASE, so we only need to set these two variables.
Now we copy tomcat into two copies, which are tomcat 1 and tomcat 2, respectively. For tomcat 1, we use the default configuration configured previously (CATALINA_HOME and CATALINA_BASE both point to the tomcache directory ), but tomcat2 we can no longer use the two variables configured on the system, so we are in catalina under the bin directory of tomcat2. sh temporary modification set CATALINA_HOME and CATALINA_BASE to the tomcat 2 root directory, if you add tomcat, and so on.
Load Balancing between Apache and multiple Tomcat clusters in Linux
Nginx Tomcat Cluster load balancing solution notes
Instance details Tomcat component installation + Nginx reverse proxy Tomcat + Apache use mod_jk and mod_proxy Reverse Proxy and load balancing
Build an Apache + Tomcat environment (JK deployment process)
In-depth analysis of Tomcat PDF
Tomcat details: click here
Tomcat: click here
This article permanently updates the link address: