日期:2014-05-16 浏览次数:20933 次
#========tomcat1======== worker.tomcat1.port=8009 #ajp13 端口号,在tomcat下server.xml配 置,默认8009 worker.tomcat1.host=localhost #tomcat的主机地址,如不为本机,请填写ip地址 worker.tomcat1.type=ajp13 worker.tomcat1.lbfactor = 1 #server的加权比重,值越高,分得的请求越多 #========tomcat2======== worker.tomcat2.port=9009 #ajp13 端口号,在tomcat下server.xml配置, worker.tomcat2.host=192.168.1.3 #tomcat的主机地址,如不为本机,请填写ip地址 worker.tomcat2.type=ajp13 worker.tomcat2.lbfactor = 1 #server的加权比重,值越高,分得的请求越多 #========controller,负载均衡控制器======== worker.controller.type=lb worker.controller.balanced_workers=tomcat1,tomcat2 #指定分担请求的tomcat worker.controller.sticky_session=false #worker.controller.sticky_session=1
把server.xml中注释部分 <!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>--> 替换如下cluster配置内容: <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8"> <!-- <Manager className="org.apache.catalina.ha.session.BackupManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" mapSendOptions="8"/> --> <!-- --> <Manager className="org.apache.catalina.ha.session.DeltaManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000"/> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="4000" autoBind="100" selectorTimeout="5000" maxThreads="6"/> <!-- timeout="60000"--> <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter"> <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender" /> </Sender> <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/> </Channel> <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/>