Configure Tomcat cluster

xiaoxiao2021-03-06  71

0. Summary 0.1 Target configuration of Tomcat clusters that scalable, high available, load balancing and error recovery

0.2 License Agreement GNU Free Documentation license allows any reprinted, but please keep this document if there is a modification, please notify the author

1. Download 1.1 Tomcat1.2 Tomcat Session Replication Library

2. Installation 2.1 first Tomcat

$ TAR VFXZ JAKARTA-TOMCAT-4.1.27.tar.gz

$ cp -r jakarta-tomcat-4.1.27 / www / server / tomcat1

2.2 Second Tomcat # temporarily not installing, after configuring a Tomcat, copy the copy directly, modify it on the basis of a copy

2.3 JK2 # Please refer to "WEB Server" under Linux Support JSP / PHP.

3. Configuring 3.1 Apache JK2 Profile Workers2.properties # This is the Apache's JK2 profile, located in the confed directory in the Apache installation directory, if there is no such file, the new # content is as follows

$ VI WORKERS2.PROPERTIES

[SHM]

File = $ {serverroot} /logs/shm.file

SIZE = 1048576

#First Tomcat

[channel.socket: Tomcat1]

Port = 11009

Host = 127.0.0.1

[AJP13: Tomcat1]

Channel = CHANNEL. Socket: Tomcat1

# SECOND TOMCAT

[channel.socket: Tomcat2]

Port = 12009

Host = 127.0.0.1

[AJP13: Tomcat2]

Channel = CHANNEL. Socket: Tomcat2

# Loading balance

[lb: lb1]

Worker = ajp13: Tomcat1

Worker = ajp13: Tomcat2

# Uri mapping

[URI: / *. jsp]

Group = lb: lb1

3.2 First Tomcat JK2 Profile JK2.Properties # This is the first Tomcat's JK2 profile, located in the first Tomcat installation directory in the confed directory # Find ChannelSocket.port = 8009 # Cancel the comment, and modify

Channelsocket.port = 11009

3.3 The first Tomcat configuration file server.xml # This is the first Tomcat configuration file, located in the confed directory in the first Tomcat installation directory # Find

# change into

# Open JK2 AJP Connector, close other Connector (that is, remove other Connector delete or comment) # 修 j j j j a 11 11 11 11 11 11 11 11 样 11 样 11 样 11象 11象 11 样 样 样 样 样 样 样 样 样

Port = "11009"

MinProcessors = "5" maxprocessors = "75"

Acceptcount = "10"

Debug = "0" />

# Added the following Manager for webapping of WebApp, which needs to be supported by the cluster.

"=". * /. jpg;. * /. jpeg;. * /. js "

Debug = "0" />

Debug = "10"

PRINTTSCREEN = "True"

SaveonRestart = "false"

MaxAntive Researchions = "- 1"

MINIDLESWAP = "- 1"

Maxidleswap = "- 1"

MaxidleBackup = "- 1"

Pathname = "NULL"

PrintSessionInfo = "True"

Checkinterval = "10"

ExpiresessionsSonShutdown = "false"

ServiceClass = "org.apache.catalina.cluster.mcast.mcastservice"

McastAddr = "228.1.2.3"

Mcastport = "45566"

McastFrequency = "500"

McastDroptime = "5000"

TCPListenAddress = "auto"

TCPListenport = "4001"

TCPSELECTORTIMEOUT = "100"

TCPTHREADCOUNT = "2"

Usedirtyflag = "true">

3.4 First Tomcat startup script catalina.sh # This is the first Tomcat startup script, located in the bin directory in the first Tomcat installation directory # Add the launch environment variable as follows

Java_home = / usr / java / jdk

Catalina_Home = / WWW / Server / Tomcat1

# Java_home here point to the path to the system actually install JDK # The Catalina_Home here point to the first Tomcat installation path

3.5 Copy the first Tomcat to get the second Tomcat

cp -r tomcat1 Tomcat2

3.6 Second Tomcat JK2 Profile JK2.Properties # Reference 3.2 # Modify ChannelSocket.Port

Channelsocket.port = 12009

# 注意 和 和 和 差 差 差 差

3.7 Second Tomcat configuration file server.xml # Reference 3.3 # Modify Close port is

# Modify the port of JK2 AJP Connector to 12009, the modified Connector may like the following

Port = "12009"

MINPROCESSOORS = "5"

MaxProcessors = "75"

Acceptcount = "10"

Debug = "0" />

# 注意 和 和 和 差 差 差 差

3.8 Second Tomcat startup script Catalina.sh # Reference 3.4 # Add startup environment variables as follows

Java_home = / usr / java / jdk

Catalina_Home = / WWW / Server / Tomcat2

# J 此 j_ 指 指 的 系统 系统 的 路 路 的 路 实 安装 安装 # 安装 安装 安装 安装 路 路 安装 安装 路 安装 安装 安装 安装 安装 安装 向 安装 路

4. Complete 4.1 RACHE

$ Apache / Bin / Apachectl Graceful

4.2 Start the first Tomcat

$ Tomcat1 / Bin / Catalina.sh Start

4.3 Start the second Tomcat

$ Tomcat2 / bin / catalina.sh start

5. References http://www-900.ibm.com/developerWorks/cn/java/l-jetspeed/http://www.filip.net/tomcat/

转载请注明原文地址:https://www.9cbs.com/read-88151.html

New Post(0)