使用apache2.0.57+tomcat5.5.9+mod_jk_1.2.15配置tomcat集群

使用apache2.0.57+tomcat5.5.9+mod_jk_1.2.15配置tomcat集群
1。apache2.0.57安装
在linux as4 亲测!
[@more@]
使用apache2.0.57+tomcat5.5.9+mod_jk_1.2.15配置tomcat集群
1。apache2.0.57安装
$ gzip -d httpd-2.0.42.tar.gz
$ tar xvf httpd-2.0.42.tar
$ ./configure --enable-mods-shared=most --enable-ssl=shared
$ make
$ make install
2。tomcat5.5.9安装
# unzip jakarta-tomcat-5.5.9.zip
# chmod a+x jakarta-tomcat-5.5.9/bin/*.sh
3. mod_jk安装
  # cd /usr/local/
  # tar xzvf jakarta-tomcat-connectors-1.2.14-src.tar.gz
  # cd jakarta-tomcat-connectors-1.2.14-src/jk/native
  # chmod 755 buildconf.sh
  # ./buildconf.sh
  # ./configure --with-apxs=/usr/local/apache/bin/apxs
  # make
  # make install
  # cd /usr/local/jakarta-tomcat-connectors-jk1.2.14-src/jk/native/apache-2.0/
  # cp mod_jk.so /usr/local/apache/modules/
4. apache2 配置
修改httpd.conf
在# LoadModule foo_module modules/mod_foo.so"下面加入
#
# 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

创建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=localhost
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:
# ----&gt lbfactor must be > 0
# ----&gt Low lbfactor means less work done by the worker.
worker.tomcat1.lbfactor=100

# ------------------------
# Second tomcat server
# ------------------------
worker.tomcat2.port=8109
worker.tomcat2.host=localhost
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:
# ----&gt lbfactor must be > 0
# ----&gt 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:
# ----&gt 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
#
这里tomcat1和tomcat2的端口分别是8009,8109
5. tomcat设置
修改server.xml文件
5.1。Add a unique jvmRoute to the Catalina engine
修改

并启用(原来被注释掉的)

但是要把下面的

注释掉
tomcat2的server.xml上把jvmRoute="tomcat1"改成jvmRoute="tomcat2"
5.2。Change the control port
修改

tomcat2的server.xml上把8005改成8105,tomcat1不变
5.3. Change the AJP13 port
修改
port="8009"

port="8109"
tomcat2的server.xml上把8009改成8109,tomcat1不变
5.4. Disable the standalone HTTP port
We don't want or need our tomcat servers to directly respond to HTTP requests. So we comment out the HttpConnector section between lines and 58 in the server.xml file.
Example:
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --&gt
<!--
port="8080" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="60000"/>
--&gt
NOTE: If you don't comment this out, you will need to change the port numbers so they don't conflict between tomcat instances.
5.5.Disable the WARP connector
At line 314, comment out the tag.
Example:

<!--
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true" appBase="webapps"
acceptCount="10" debug="0"/>
--&gt
Do not forget to do the same thing to tomcat2's server.xml file.
NOTE: You might want to comment out the entire element. If so, make sure and remove the comments within it - XML doesn't like comments within comments.
5.6.
把一下这行改成,增加了protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler",
有些文档上没说
    
  protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
  
  redirectPort="8443" protocol="AJP/1.3" />
6.测试
创建测试页面




Tomcat 2



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/556989/viewspace-906272/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/556989/viewspace-906272/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值