Tomcat5.5.12配置负载均衡

Tomcat5.5.12配置负载均衡

参考:http://raibledesigns.com/tomcat/

[@more@]

1:安装准备

下载Tomcat5.5.12.zip;apache_2.0.55-win32-x86-no_ssl;mod_jk.dll;

2:解压缩Tomcat5.5.12.zip设置环境变量(JAVA_HOME=C:Program FilesJavajdk1.5.0_02),安装apache_2.0.55-win32-x86-no_ssl(安装时需要填写本机的计算机名!!)

3:把mod_jk.dll COPY到..Apache2modules下,在..Apache2conf下建新文件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=11009
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=12009
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
#

4:设置confhttpd.config文件

在# Example:
# LoadModule foo_module modules/mod_foo.so
#下添加
LoadModule jk_module modules/mod_jk.dll

#
# Configure mod_jk
#
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info

在DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"下添加:

JkMount /*.jsp loadbalancer
JkMount /* loadbalancer
JkMount /servlet/* loadbalancer

5:配置tomcat的server.xml文件

(1)把改成
tomcat1:
tomcat2:

(2)把tomcat1:tomcat2:

(3)把tomcat1: tomcat2:

(4)把改成

(5)去掉注释
……………………
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tomcat1: tcpListenPort="4001"
tomcat2: tcpListenPort="4002"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
……………………

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

转载于:http://blog.itpub.net/300209/viewspace-810968/

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值