How to start multiple TOMCAT in the same system

Source: Internet
Author: User
Tags apache tomcat

<server port= "8005" shutdown= "shutdown" >

Accepts the port number of the server shutdown instruction. We call the close command port.

<connector port= "8080" protocol= "http/1.1"

connectiontimeout= "20000"

redirectport= "8443"/>

HTTP request processing port, the normal URL address we entered on the Web page includes the port. This port is called Httpport.

<connector port= "8080" protocol= "http/1.1"

connectiontimeout= "20000"

redirectport= "8443" />

Handling of HTTPS requests port. This port is called Httpsport.

<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>

Receive AJP protocol processing port. This port is called Ajpport.

<connector port= "8009" protocol= "ajp/1.3" redirectport= "8443 "/>

Handling of HTTPS requests port.

Actually, it's 4 ports.

Below I use a system to launch 3 Tomcat as an example, explain the following procedure

Assign Port

Tomcat1port Allocation table (TOMCAT1 all default configurations)

Port

Port number

Close command Port

8005

Httpport

8080

Httpsport

8443

Ajpport

8009

Tomcat2port Distribution Table

Port

Port number

Close command Port

8006

Httpport

8081

Httpsport

8444

Ajpport

8010

Tomcat3port Distribution Table

Port

Port number

Close command Port

8007

Httpport

8082

Httpsport

8445

Ajpport

8011



First, start multiple TOMCAT in WINDOWS (three for example). Method 11, use the compressed version of TOMCAT. Unzip him into a separate folder. such as: d:\user1\tomcat5.5d:\user2\tomcat5.5d:\user3\tomcat5.52, change the folder tomcat5.5\conf under the Server.xml changes <server port= " 8005 "shutdown=" shutdown "> 8005 for other port changes <connector port=" 8080 "maxhttpheadersize=" 8192 "in 8080 for other port changes < Connector port= "8009" in 8009 for other ports as I put d:\user1\tomcat5.5\conf\server.xml above the three ports 8001, 8010, 8011; d:\user2\ The three ports in the Tomcat5.5\conf\server.xml are set to 8002, 8020, 8012 respectively, and three ports in the D:\user3\tomcat5.5\conf\server.xml are set to 8003, 8030, 8013. 3, directly execute each folder Tomcat5.5\bin\startup.bat This method is easy to set up. The downside is that you'll open a very many form on the desktop, and accidentally close the form, causing the TOMCAT service to stop. In order to solve this problem, three TOMCAT can be set up as a system service. 4, Write and execute installserviceu.bat batch file. The contents of the file are as follows: REM installation Tomcatuser1 Service Set Catalina_base=d:\user1\tomcat5.5set catalina_home=d:\user1\tomcat5.5call d:\user1\ Tomcat5.5\bin\service.bat Install Tomcatuser1rem installation tomcatuser2 Service Set Catalina_base=d:\user2\tomcat5.5set Catalina_ Home=d:\user2\tomcat5.5call D:\user2\tomcat5.5\bin\service.bat Install Tomcatuser2rem installation Tomcatuser3 Service Set Catalina_base=d:\user3\tomcat5.5set catalina_home=d:\user3\tomcat5.5call d:\user3\tomcat5.5\bin\ Service.bat Install Tomcatuser3 performs the above batch processing, the system adds a three system service. Assuming that your system has a Tomcat Windows Installer installed, another Apache Tomcat service will be on the system. 5, to this, can use two ways to start TOMCAT, the first is said directly execute each folder in Tomcat5.5\bin\startup.bat.

The second is to start the services in Windows Service Management, or set up the service to be proactive, so that he starts with Windows on their own initiative. 6. Although we are able to execute the TOMCAT service in the way above. But we cannot directly execute Tomcat5.exe and Tomcat5w.exe.

The reason is that the two programs only look for a TOMCAT5 service (shown as Apache Tomcat). Follow the settings in this service. Method Two (this method originally did not want to say here, but the online introduction of the more, but I think there is a way, there is no need for the way two. Because of the complexity of the setup, I have not yet found that this setting has other advantages over the above method, but it must be set in single-user mode in LINUX. 1, use the compressed version of TOMCAT, separate him into different folders, such as: d:\user1\tomcat5.5d:\user2\tomcat5.5d:\user3\tomcat5.52, set up WINDOWS Environment variables: catalina_base1=d:\user1\tomcat5.5.25catalina_home1=d:\user1\tomcat5.5.25catalina_base2=d:\user2\ Tomcat5.5.25catalina_home2=d:\user2\tomcat5.5.25catalina_base2=d:\user3\tomcat5.5.25catalina_home2=d:\user3\ Tomcat5.5.25path= D:\USER1\tomcat5.5.25\bin; D:\user1\tomcat5.5.25\bin;d:\user1\tomcat5.5.25\bin; $PATH 3, change the contents of Catalina.bat and Startup.bat files in three TOMCAT folders Catalina_base respectively: Catalina_base1, Catalina_base2, Catalina_base3. Catalina_home were changed to Catalina_home1, Catalina_home3 and Catalina_home3 respectively. If I change the Catalina.bat in the D:\user1\tomcat5.5\bin\ folder and the Catalina_base in Startup.bat to Catalina_base1,catalina_home instead of Catalina _HOME1: Change the catalina_base of Catalina.bat and Startup.bat in the D:\user2\tomcat5.5\bin\ folder to Catalina_base2. Catalina_home Change to Catalina_home2; change catalina_base in D:\user3\tomcat5.5\bin\ folder Catalina.bat and Startup.bat to Catalina_base3,catalina_home to Catalina_home3. 4, now directly execute startup.bat. 1. Start multiple TOMCAT in LINUX.

(same as three for example) method one (single-user mode) launches multiple TOMCAT in single-user mode in LINUX. is similar to another method of starting multiple TOMCAT in WINDOWS. You can try it.

I highlight method two. Method Two (multi-user mode) finally introduced a kind of my original method which launches the multiple TOMCAT in the LINUX, this method is I to draw lessons from above several methods summarizes.

1. Build LINUX users and Groups Groupadd Tomcatuseradd user1-g tomcatuseradd user2-g tomcatuseradd user3-g tomcat2, unzip the tar package TOMCAT to the user master folder, the folder name is set to TOMCAT5.5.

folder structure such as the following:/HOME/USER1/TOMCAT5.5//HOME/USER2/TOMCAT5.5//HOME/USER3/TOMCAT5.5/3, change each user's profile (under the User folder ". Bash_ Profile) to add the following content. Export catalina_base=/home/"username"/tomcat5.5export catalina_home=/home/"username"/tomcat5.5export path=.:$ Catalina_home/bin: $PATH Note: Replace "username" with "user1" "User2" "User3" 4, change the "server.xml" file in each TOMCAT. Change <server port= "8005" shutdown= "shutdown" > 8005 for other ports change <connector port= "8040" maxhttpheadersize= "8192" in 8080 change for other ports <connector port= "8009" in 8009 for other ports as I put the three port above the D:\user1\tomcat5.5\conf\server.xml 8001, 8010, 8011, respectively; The three ports in the D:\user2\tomcat5.5\conf\server.xml are set to 8002, 8020, 8012, respectively. Set the three ports in the D:\user3\tomcat5.5\conf\server.xml to 8003, 8030, 8013 respectively. 5, in order to facilitate the launch of TOMCAT, under the/usr/local/bin folder to build two shell script files, tup and Tdown.

Tup is used to start TOMCAT#!/BIN/SHCD ~cd Tomcat5.5.25/binsh Startup.shtdown used to turn TOMCAT off. #!/bin/shcd ~cd Tomcat5.5.25/binsh shutdown.sh so user1-3 can use the above two commands to start and close TOMCAT, regardless of the folder. Each of them was able to start off their TOMCAT. However, you cannot close other users ' TOMCAT. This is also very safe.

Summary: WINDOWS is a simple and convenient way to use. LINUX method Two, simple and convenient security, this method is my favorite method, but also I feel the best, the safest way.


How to start multiple TOMCAT in the same system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.