E 体系整合
# vi /usr/local/apache/conf/httpd.conf
在文件最末尾加上如下语句
#Load mod_jk
LoadModule jk_module modules/mod_jk.so
# Configure mod_jk
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /*.jsp loadbalancer
JkMount /servlet/* loadbalancer
JkMount /application/* loadbalancer
#vi /usr/local/apache/conf/workers.properties
添加下列语句
#
# workers.properties
#
# In Unix, we use forward slashes:
ps=/
# list the workers by name
worker.list=tomcat1, tomcat2, loadbalancer
# ------------------------
# First tomcat server
# ------------------------
worker.tomcat1.port=8009
worker.tomcat1.host=127.0.0.1
worker.tomcat1.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat1.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat1.lbfactor=100
# ------------------------
# Second tomcat server
# ------------------------
worker.tomcat2.port=8009
worker.tomcat2.host=192.168.1.34
worker.tomcat2.type=ajp13
# Specify the size of the open connection cache.
#worker.tomcat2.cachesize
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.tomcat2.lbfactor=100
# ------------------------
# Load Balancer worker
# ------------------------
# The loadbalancer (type lb) worker performs weighted round-robin
# load balancing with sticky sessions.
# Note:
# ----> If a worker dies, the load balancer will check its state
# once in a while. Until then all work is redirected to peer
# worker.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat1, tomcat2
#
# END workers.properties
#
#vi /usr/local/tomcat/conf/server.xml
<Connector port="8009"
protocolHandler>
redirectPort="8443" protocol="AJP/1.3" /> 第101行
在119行摆布插足如下语句(去正文)
<Engine name="Standalone" defaultHost="localhost" jvmRoute="tomcat1"></Engine>
若第二台tomcat,将jvmRoute的修正为tomcat2
体系整合终了
启动apache和tomcat办事
# /usr/local/apache/bin/apachectl start
# /usr/local/tomcat/bin/catalina.sh start
将如下内容添加至/etc/rc.d/rc.local文件末尾
以便体系启动后开启apache,tomcat办事
#vi /etc/rc.d/rc.local
添加
/usr/local/tomcat/bin/catalina.sh start
/usr/local/apache/bin/apachectl start
往事来自: 新客网(www.xker.com) 详文参考:http://www.xker.com/page/e2007/0104/2859_3.html
来自: 新客网(www.xker.com) 详文参考:http://www.xker.com/page/e2007/0104/2859_2.html
版权声明:
原创作品,许诺转载,转载时请务必以超链接方法标明文章 原始来由 、作者信息和本声明。不然将穷究法律责任。