Tomcat集群基本设置Cluster Basics


在你的Tomcat8容器中来运行session复制,应该完成以下步骤

  • All your session attributes must implement java.io.Serializable
  • Uncomment the Cluster element in server.xml
  • If you have defined custom cluster valves, make sure you have the ReplicationValve defined as well under the Cluster element in server.xml
  • If your Tomcat instances are running on the same machine, make sure the tcpListenPort attribute is unique for each instance, in most cases Tomcat is smart enough to resolve this on it's own by autodetecting available ports in the range 4000-4100
  • Make sure your web.xml has the <distributable/> element
  • If you are using mod_jk, make sure that jvmRoute attribute is set at your Engine<Engine name="Catalina" jvmRoute="node01" > and that the jvmRoute attribute value matches your worker name in workers.properties
  • Make sure that all nodes have the same time and sync with NTP service!
  • Make sure that your loadbalancer is configured for sticky session mode.
  • 1、所有的session属性必须实现序列化接口
  • 2、在server.xml中被解除注释的Cluster标签
  • 3、如果你定义了集群values,你确定有ReplicationValve值在server.xml中的Cluster元素中有定义。
  • 4、如果你的Tomcat实例运行在同一台机器上,你要保证每个Tomcat的TCP监听端口属性值唯一,可用端口范围在4000到4100
  • 5、确定在web.xml 中有<distributable/>元素
  • 6、如果你使用mod_jk插件,要保证在Engine 元素中有jvmRoute属性并且jvmRoute属性值在workers.properties中有定义。
  • 7、确保所有节点具有相同的时间和NTP服务同步!
  • 8、确保你的负载平衡器配置为sticky会话模式。

负载均衡可以通过很多技术来实现,如Load Balancing(负载平衡)的章节所看到的。


Note: Remember that your session state is tracked by a cookie, so your URL must look the same from the out side otherwise, a new session will be created.


注:记住你的会话状态是由一个cookie跟踪,所以你的URL必须从外面同一个浏览器请求,否则看起来一样其实一个新的会话将被创建。


集群支持目前需要JDK 1.5或更高版本。


The Cluster module uses the Tomcat JULI logging framework, so you can configure logging through the regular logging.properties file. To track messages, you can enable logging on the key:org.apache.catalina.tribes.MESSAGES

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值