linux下tomcat+apache集群配置说明

时间:2024.4.20

版本履历

linux下tomcatapache集群配置说明

Apache2+mod_jk+tomcat集群配置说明

1、 两个应用服务器,每个8G内存,则每台部署两个tomcat,一共4个tomcat构成集群,每个tomcat

分配3G内存。发布时,对一台机器的tomcat1进行更新,更新后拷贝system目录(不是tomcat1)覆盖同一台机器的tomcat2及另一台机器上的tomcat1、tomcat2,使用最新发布工具可发布一台机器多个tomcat,另一台还需拷贝system覆盖。对于每个12G及以上的,每台布置3个tomcat,虚拟内存分配3G。

2、 一个应用服务器,只有8G内存,布置3个tomcat,每个tomcat分配2G。有12G内存的机器,

布置3个tomcat,每个tomcat分配3G。

3、 集群的tomcat,外加一个目录tomcat_jq,对于多台机器的集群,注意部署对称,即一台机器

上布置了2个tomcat,另一台也需布置同样个数tomcat。每个tomcat按tomcat1、tomcat2、tomcat3命名。

4、 虚拟内存配置(linux)

a) 在catalina.sh中第一行前加

b) export JAVA_OPTS="-server -Xms3000m -Xmx3000m -XX:MaxNewSize=512m -XX:PermSize=1000m -XX:MaxPermSize=1000m -Djava.awt.headless=true" c) -Xms3000m -Xmx3000m,表示3G虚拟内存,两个值一致,其他参数不改。

5、 集群的具体配置。

linux下tomcatapache集群配置说明

linux下tomcatapache集群配置说明

linux下tomcatapache集群配置说明

linux下tomcatapache集群配置说明

linux下tomcatapache集群配置说明

linux下tomcatapache集群配置说明


第二篇:linux下apache,tomcat整合


liunx下apache、tomcat整合

1、准备

下载需要的文件。这里假定你已经正确安装配置好了JDK。

到Apache官方网站下载所需要的文件:

httpd-2.2.0.tar.gz

apache-tomcat-5.5.12.tar.gz

jakarta-tomcat-connectors-1.2.15-src.tar.gz

其中httpd和jakarta-tomcat-connectors为源码包,apache-tomcat为二进制包。

2、安装apache

代码:

# tar xzvf httpd-2.2.0.tar.gz

# cd httpd-2.2.0

# ./configure --prefix=/usr/local/apache2 --enable-so

# make

# make install

3、安装Tomcat

代码:

# cp apache-tomcat-5.5.12.tar.gz /usr/local/

# cd /usr/local

# tar xzvf apache-tomcat-5.5.12.tar.gz

# ln -s apache-tomcat-5.5.12 tomcat // 建立连接 这一步不需要

4、编译生成mod_jk

代码:

# tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz

# cd jakarta-tomcat-connectors-1.2.15-src/jk/native

# ./configure --with-apxs=/usr/local/apache2/bin/apxs

# make

# cp ./apache-2.0/mod_jk.so /usr/local/apache2/modules/ //如果直接下载的是.so的tomcat连接文件的话,只需将名称改为mod_jk.so,然后放在modules目录下就可。

5、配置

如果服务器上没有配置虚拟主机的话,下面这些配置是可以的。

在/usr/local/apache2/conf/下面建立两个配置文件mod_jk.conf和workers.properties。

# vi mod_jk.conf

添加以下内容:

代码:

# 指出mod_jk模块工作所需要的工作文件workers.properties的位置

JkWorkersFile /usr/local/apache2/conf/workers.properties

# Where to put jk logs

JkLogFile /usr/local/apache2/logs/mod_jk.log

# Set the jk log level [debug/error/info]

JkLogLevel info

# Select the log format

JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicate to send SSL KEY SIZE,

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format

JkRequestLogFormat "%w %V %T"

# 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat来处理 JkMount /servlet/* worker1

JkMount /*.jsp worker1

JkMount /*.do worker1

JkMount /*.action worker1

//最好是处理转发是单独的一个虚拟主机,因为即使配置了/*.jsp,/*.do,/*.action ,但是tomcat项目中还有好多其他的资源,有些还与php冲突,所以最好是/* worker1,将这台虚拟目录下的所有请求都交给tomcat处理。

如果服务器上配置了虚拟主机的话,应该在虚拟主机的配置里进行请求的转发:

<VirtualHost *:80>

ServerAdmin Admin@wecare99.org

DocumentRoot /var/www/html/wecare99_net

ServerName

ErrorLog logs/wecare99_net_log

CustomLog logs/wecare99_net-access_log common

JKMount /* worker1

</VirtualHost>

而且DocumentRoot没有必要必须和tocmcat的项目目录一致。这个网上的资料大多是互相抄袭,糊弄人的。

下面是配置worker1,只需配置到端口那块就可以。往下的部分有错误。网上的大多是错误的。

# vi workers.properties

添加以下内容:

代码:

# Defining a worker named worker1 and of type ajp13

worker.list=worker1

# Set properties for worker1

worker.worker1.type=ajp13

worker.worker1.host=localhost

worker.worker1.port=8009

#worker.worker1.lbfactor=50

#worker.worker1.cachesize=10

#worker.worker1.cache_timeout=600

#worker.worker1.socket_keepalive=1

#worker.worker1.socket_timeout=300

再配置httpd.conf,作以下修改:

将Listen 80 修改为 Listen 127.0.0.1:80 // 没有必要

将ServerName 修改为 ServerName LocalHost:80 //没有必要

增加关于加载mod_jk的语句:

代码:

LoadModule jk_module modules/mod_jk.so

//如果配置了虚拟主机,且在虚拟主机的配置的地方进行了其的配置,下面这句不要在引入了。

Include /usr/local/apache2/conf/mod_jk.conf

最后编辑Tomcat的配置文件server.xml,在HOST段中加入:

代码:

<Context path="" docBase="webapps" debug="0" reloadable="true" crossContext="true"/>

验证:在浏览器地址栏中输入tomcat项目带上tomcat端口的访问路径,如果成功,则tomcat配置成功。

在浏览器地址栏中输入服务器地址:apache端口号/,如果成功,则apache配置成功。

在地址栏中输入tomcat项目的方法路径将端口号改成apache的端口号,如果成功,则apache和tomcat整合成功。

更多相关推荐:
The cop and the anthem鉴赏

AbouttheauthorOhenryoriginallynamedWilliamSydneyPorterwhoisoneoffamousshortstorywriterinAmericaHisshortsi...

The Cop and the Anthem读后感

NowheretoStayTheCopandtheAnthemisoneofOHenrysrepresentativeworksThisnoveldescribesavagrantwhoisjoblesshomelessandco...

The Cop and the Anthem警察与赞美诗读后感

TheCopandtheAnthemTheCopandtheAnthemisoneofOHenry39srepresentativeworksOHenryisoneofthemostfamousAmericancriticalre...

The Cop and the Anthem读后感

BookReportNameTheCopandtheAnthemonearticleoftheShortStoriesbyOHenryWriterOHenryAFamousAmericanWriterPublishmentPeik...

An Analysis of the Cop and the Anthem

学号哈尔滨师范大学学士学位论文题目AnAnalysisoftheCopandtheAnthem学生指导教师年级20xx级专业英语系别英语系学院学士学位论文题目AnAnalysisoftheCopandtheAn...

The Cop and the Anthem

TheCopandtheAnthemOHenryOnhisbenchinMadisonSquareSoapymoveduneasilyWhenwildgoosehonkhighofnightsandwhenwomenwithout...

The Cop And The Anthem

TheCopAndTheAnthemOHenryOnhisbenchinMadisonSquareSoapymoveduneasilyandwhenSoapymovesuneasilyonhisbenchintheparkyoum...

The Semiotic Square in the Cop and the Anthem Word 文档

TheSemioticSquareintheCopandtheAnthemTheCopandtheAnthemisoneofthebeststoriesaboutthecrisisofhumannaturewr...

An Eco-critical Analysis of The Cop and the Anthem

AnEcocriticalAnalysisofTheCopandtheAnthemWilliamSydneyPorterSeptember111862June519xxknownbyhispennameOHenryisundoub...

欧.亨利(O.HERRY) --The Cop and the Anthem

TheCopandtheAnthemSoapymoveduneasilyonhisbenchInMadisonsquareitwasasignthatwinterwascomingAdeadleaffellontoSoapysla...

6人左右的英文剧本 The cop and the anthem

Thecopandtheanthem警察与赞美诗PpolicemanTthiefSshopmanagerOoldmanWwaiterAtthegateofaprisonPpoliceman1TthiefPpul...

警察与赞美诗The Cop and the Anthem (2)

SoapyswayofdefendinghisdignityAppreciationofTheCopandtheAnthemOncewelookatthetitlewemayhaveapicturethatinastablecou...

the cop and the anthem读后感(18篇)