Using Linux to build Server (ii)-TOMCAT single-machine multi-instance

Source: Internet
Author: User
Tags server port tomcat server

This article takes the above, in the built Linux environment, installs the server software, here uses the commonly used Tomcat as the example

Tomcat is a lightweight Web server that is generally used as an application server to enable

Download wget http://mirrors.shuosc.org/apache/tomcat/tomcat-9/v9.0.1/bin/apache-tomcat-9.0.1.tar.gz

Directory structure

Bin: Binary folder for executable scripts, such as startup.sh

Conf: the location of the configuration file, such as the core configuration file of Tomcat Server.xml

Temp: Run tomcat-generated temporary files

WebApps: Apply Default deployment Location

Storage of the jar package used by the Lib:tomcat

Work: Application of bytecode file storage, such as JSP file compiled servlet file

Logs: Log file

Here are some of the more important parts of the Server.xml file.

The server port is used to listen for Tomcat shutdown commands

Connector port is mainly divided into two kinds of HTTP protocol, for listening to HTTP requests, and the other is the AJP protocol, for listening to AJP form of requests

AppBase: Application Deployment Ground Autodeploy: Hot deployment that automatically deploys apps in Tomcat run Unpackwars: Unzip the war package

Configure the Tomcat standalone multi-instance to support an application so that the service can still be serviced while a tomcat is dead, while also facilitating server software upgrades

Steps

TAR-ZXF apache-tomcat-9.0.1.tar.gz Tomcat9

CD Tomcat9

Create a Tomcat instance directory

Mkdir-p INSTANCE/TOMCAT1

Mkdir-p INSTANCE/TOMCAT2

Create bin,logs,temp,work separately under TOMCAT1 and TOMCAT2

Copy the Conf folder in Tomcat9 to Tomcat1 cp-r tomcat9/conf INSTANCE/TOMCAT1 and repeat this action for TOMCAT2

Open TOMCAT1 under Conf folder Server.xml

VI server.xml Click I to enter the insert mode, respectively modify the server port, Connetor port, the host's AppBase property changed to TOMCA9 under the WebApps (easy to unify deployment, apply the update) and then Wq exit, TOMCAT2 Repeat this action

Enter the bin directory of the TOMCAT1, create the startup script for the instance, and close the script

VI startsh.sh

#!/bin/sh

Export JRE_HOME=/USR

Export Catalina_home=/root/tomcat9

Export catalina_base="/ROOT/TOMCAT9/INSTANCE/TOMCAT1" #tomcat工作目录

Export catalina_tmpdir="$CATALINA _base/temp"

Export catalina_pid="$CATALINA _base/bin/tomcat1.pid"

Export java_opts="-SERVER-XMS1024M-XMX1024M-DJAVA.AWT.HEADLESS=TRUE-DTOMCAT.NAME=TOMCAT1"

Bash $CATALINA _home/bin/startup.sh "[email protected]"

VI shutdown.sh

Export JRE_HOME=/USR

Export Catalina_home=/root/tomcat9

Export catalina_base="/ROOT/TOMCAT9/INSTANCE/TOMCAT1" #tomcat工作目录

Export catalina_tmpdir="$CATALINA _base/temp"

Export catalina_pid="$CATALINA _base/bin/tomcat1.pid"

Bash $CATALINA _home/bin/shutdown.sh "[email protected]"

Tomcat2 Bin folder Repeat the steps above to create a startup script and close the script

Create a total startup script and close script under the Bin folder of the Tomcat9

VI tomcat9start.sh

#!/bin/sh

sh/root/tomcat9/instance/tomcat1/bin/startup.sh

sh/root/tomcat9/instance/tomcat2/bin/startup.sh

VI tomcat9shut.sh

sh/root/tomcat9/instance/tomcat1/bin/shutdown.sh

sh/root/tomcat9/instance/tomcat2/bin/shutdown.sh

At this point, the Tomcat standalone multi-instance step is complete

Using Linux to build Server (ii)-TOMCAT single-machine multi-instance

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.