免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1127 | 回复: 0
打印 上一主题 下一主题

使用apache2.0.57+tomcat5.5.9+mod_jk_1.2.15配置tomcat集群 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-09-22 15:42 |只看该作者 |倒序浏览

使用apache2.0.57+tomcat5.5.9+mod_jk_1.2.15配置tomcat集群
mod_jk_1.2.15下载点
http://apache.justdn.org/jakarta/tomcat-connectors/jk/source/jk-1.2.15/
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:
#  ----> lbfactor must be > 0
#  ----> 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:
#  ----> 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
#
这里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:
-->   
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:
-->
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",
有些文档上没说
  
6.测试
创建测试页面
Tomcat 2


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/26257/showart_387660.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP