`
hypercube1024
  • 浏览: 83854 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

tomcat使用terracotta集群配置

    博客分类:
  • java
阅读更多
tomcat的session同步方案会把session复制到每个节点,会随着服务器的增加很快达到性能瓶颈。terracotta是开源的集群框架,能无缝的保存服务器的session。

1, 安装terrcotta服务器

2, 安装terrcotta的session jar
拷贝如下文件到每个节点tomcat的lib目录
${TERRACOTTA_HOME}/sessions/terracotta-session-<version>.jar
${TERRACOTTA_HOME}/common/terracotta-toolkit-<API-version>-runtime-<version>.jar

3,配置session集群
在tomcat的conf/context.xml中添加
<Valve className="org.terracotta.session.TerracottaTomcat60xSessionValve" tcConfigUrl="127.0.0.1:9510" />
tcConfigUrl为terracotta服务器地址

如果是用apache做负载均衡,要把粘性会话设为false
worker.loadbalancer.sticky_session=false

启动terrcotta服务器,apache和每个tomcat

运行Terracotta Developer Console可以在topology -> connected clients 中看到已经连接的客户端的情况,启动了几个tomcat应该就能看到几个
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics