轻松实现Apache,Tomcat集群和负载均衡

来自:
http://hi.baidu.com/luodaijun/blog/item/5bbe4cfb5ffef864034f56a1.html

workers.properties文件内容

worker.list = controller,tomcat1,tomcat2  #server 列表
#========tomcat1========
worker.tomcat1.port=9009  #ajp13 端口号,在tomcat下server.xml配置,默认8009      
worker.tomcat1.host=localhost  #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor = 10   #server的加权比重,值越高,分得的请求越多
#========tomcat2========
worker.tomcat2.port=8009  #ajp13 端口号,在tomcat下server.xml配置,默认8009      
worker.tomcat2.host=localhost  #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor = 10   #server的加权比重,值越高,分得的请求越多

#========controller,负载均衡控制器========
worker.controller.type=lb
worker.controller.balanced_workers=tomcat1,tomcat2   #指定分担请求的tomcat
worker.controller.sticky_session=true


tomcat的server.xml文件中要注意:
jvmRoute="tomcat2"
这里的tomcat2对应着workers.properties的tomcat2

你可能感兴趣的:(apache,html,tomcat,xml,Blog)