session - tomcat 6 - 集群/备份管理器

标签 session tomcat cluster-computing failover

我有一个关于使用 BackupManager 在 tomcat 6 中进行集群( session 复制/故障转移)的问题。我选择 BackupManager 的原因是因为它将 session 仅复制到另一台服务器。

我将通过下面的示例来尝试解释我的问题。

  • 我在带有 BackupManager 的 tomcat 6 集群中设置了 6 个节点。前端是一台使用 mod_jk 并启用粘性 session 的 Apache 服务器
  • 每个节点都有 1 个 session 。 node1 有来自 client1 的 session node2 有来自 client2 的 session .. ..
  • 现在假设 node1 宕机了;假设node2是备份,node2现在有两个 session (针对client2和client1)
  • 下次 client1 发出请求时,到底会发生什么? Apache 是否“知道”node1 已关闭并且是否将请求直接发送到node2?

    =或=

    它是否会尝试 6 个实例中的每一个并找出备份是谁?

最佳答案

不太确定 BackupManager 的工作原理,我读过这篇好文章 URL表明复制在识别备份方面足够智能。

In-memory session replication, is session data replicated across all Tomcat instances within the cluster, Tomcat offers two solutions, replication across all instances within the cluster or replication to only its backup server, this solution offers a guaranteed session data replication ...

SimpleTcpCluster uses Apache Tribes to maintain communicate with the communications group. Group membership is established and maintained by Apache Tribes, it handles server crashes and recovery. Apache Tribes also offer several levels of guaranteed message delivery between group members. This is achieved updating in-session memory to reflect any session data changes, the replication is done immediately between members ...

You can reduce the amount of data by using the BackupManager (send only to one node, the backup node)

如果设置了 notifyListenersOnReplication="true",您将能够从日志中看到这一点。

另一方面,您仍然可以使用 DeltaManager 并将集群拆分为 3 个域,每个域有 2 台服务器。

假设这些节点是节点 1 <-> 节点 2、3 <-> 4 和 5 <-> 6。

在这种情况下 - 配置工作属性将确保 session 复制仅在域内发生。

然后 mod_jk 肯定知道当 node1 发生故障时要查看哪个服务器。

http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

Currently you can use the domain worker attribute (mod_jk > 1.2.8) to build cluster partitions with the potential of having a more scaleable cluster solution with the DeltaManager(you'll need to configure the domain interceptor for this).

此链接上有一个更好的示例:

http://people.apache.org/~mturk/docs/article/ftwai.html

请参阅“域集群模型”部分。

关于session - tomcat 6 - 集群/备份管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2925325/

相关文章:

ruby-on-rails - rails3 devise - 没有路由匹配 "/sessions/user"

ruby-on-rails - 在 Rails 中获取 session 数据

java - 使用 session 序列化处理 Vaadin 中不可序列化的 Guava EventBus

php - 在 PHP 中传递 $_SESSION

java - 如何在1个web.xml中定义2个servlet

jsp - jsf上下文创建

kubernetes - Kubernetes 是否支持在集群中的多个节点之间共享持久卷?

hadoop - Hadoop 不是更像一个网格而不是一个集群吗?

javascript - 将 AngularJS 代码构造成 WAR 包

r - 在矩阵中识别 "clusters"或 "groups"