Tomcat: Tomcat design ideas in a cloud environment--tomcat multi-instance installation

Source: Internet
Author: User
Tags glassfish

Cloud is now a popular technology, and Tomcat is a Web server that people who learn Java are generally exposed to, what if you use Tomcat in a cloud environment? Inevitably, multiple Tomcat will be installed, known as the Tomcat instance, and then managed by multiple Tomcat via the cloud platform.

How do I install multiple Tomcat instances on a single machine?

This question has presumably been used by Tomcat people to know:

1) Download Tomcat.zip

2) Unzip, after the Tomcat copy 1 copies, each is called an instance, and modifies the Tomcat instance the port in the Tomcat_home/conf/server.xml is OK.

3) To create the actual instance, just repeat step 2).

Yes, it is, it is simple and easy to operate. However, there is another way to deal with it, which is similar to WebLogic and GlassFish.

The processing of GlassFish can be summarized as follows:

1) Install GlassFish, (this process will glassfish the common jar package in a common place)

2) Create each instance, as long as you add the appropriate configuration, work dir.

Follow this approach to install multiple Tomcat:

1) Unzip to the installation directory

2) Create a Tomcat instance: Copy config, logs, tmp, WebApps, work directory, and then modify the port in the Config/server.xml.

3) To create another instance, just repeat step 2).

Example:

1) Unzip the apache-tomcat-6.0.41,

2) Install the Tomcat instance: Create the instance directory apache-tomcat-6.0.41-instances, and create the ins1, Inst2 directory in the directory that is used as a directory for two instances. Copy conf, logs, temp, WebApps, work to ins1, Ins2 directory.

3) Modify the instance port:ins1 use the default port and modify the port in the ins2, i.e.:

INS2 ports are: 8005–>9005, 8080--à9080, 8443--à9443

4) Create the Startup.bat file and copy it to the ins1, Ins2 directory:

The code is as follows:

@echo  on@echoDelete Work directory ...rmdir/s/q%CD%\ Work@echo SetEnv...SETJava_home=e:\programFiles\java\jdk1.8.0_20SET PATH=%java_home%\bin;%PATH%@echoInstance root directorySETcatalina_base=%CD%@echo StartinstanceCD.. /.. /apache-tomcat-6.0.41/Bincatalina. batStart
View Code


5) Access test: Access ins1, Ins2:

Execute ins1, ins2 startup.bat file start ins1, ins2 respectively.

Enter http://localhost:8080, http://localhost:9080 on the browser to access the Tomcat home page.

Cloud-related design, in fact, is the use of this principle to achieve.

Tomcat: Tomcat design ideas in a cloud environment--tomcat multi-instance installation

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.