哪个集群节点应该处于活动状态?

发布于 2024-09-04 02:05:13 字数 177 浏览 8 评论 0原文

有一些集群和一些unix网络守护进程。该守护进程在每个集群节点上启动,但只有一个节点可以处于活动状态。

当活动守护进程中断时(无论节点的程序中断),其他节点应变为活动状态。

我能想到几种可能的算法,但我认为已经对此进行了一些研究,并且有一些现成的算法?我说得对吗?你能指出我的答案吗?

谢谢。

There is some cluster and there is some unix network daemon. This daemon is started on each cluster node, but only one can be active.

When active daemon breaks (whether program breaks of node breaks), other node should become active.

I could think of few possible algorithms, but I think there is some already done research on this and some ready-to-go algorithms? Am I right? Can you point me to the answer?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴者 2024-09-11 02:05:13

Jgroups 是一个 Java 网络堆栈,其中包括 DistributedLockManager 类型的支持和集群投票功能。这些允许任意数量的 UNIX 守护进程就谁应该处于活动状态达成一致。例如,所有节点都可能尝试获取锁,并且只有一个节点会成功,直到应用程序或节点失败。

Jgroups 还有特定通信通道协调器的概念。一次只有一个节点可以成为协调员,当一个节点发生故障时,另一个节点将成为协调员。测试您是否是协调员很简单,在这种情况下您将处于活动状态。

请参阅:http://www.jgroups.org/javadoc/org/ jgroups/blocks/DistributedLockManager.html

如果您要自己实现此功能,则需要记住很多内容:

  • 每个节点都需要具有一致的集群视图。
  • 所有节点都需要通知所有其余节点它们在线——可能通过多播。
  • 离线的节点(由于 ap 或节点故障)需要从所有其他节点的“视图”中删除。
  • 然后,您可以让 IP 最低的节点或其他节点成为活动节点。
  • 如果这不合适,那么您将需要进行某种投票交换,以便节点可以就谁是活跃的达成一致。类似于: http://en.wikipedia.org/wiki/Two-phase_commit_protocol

Jgroups is a Java network stack which includes DistributedLockManager type of support and cluster voting capabilities. These allow any number of unix daemons to agree on who should be active. All of the nodes could be trying to obtain a lock (for example) and only one will succeed until the application or the node fails.

Jgroups also have the concept of the coordinator of a specific communication channel. Only one node can be coordinator at one time and when a node fails, another node becomes coordinator. It is simple to test to see if you are the coordinator in which case you would be active.

See: http://www.jgroups.org/javadoc/org/jgroups/blocks/DistributedLockManager.html

If you are going to implement this yourself there is a bunch of stuff to keep in mind:

  • Each node needs to have a consistent view of the cluster.
  • All nodes will need to inform all of the rest of the nodes that they are online -- maybe with multicast.
  • Nodes that go offline (because of ap or node failure) will need to be removed from all other nodes' "view".
  • You can then have the node with the lowest IP or something be the active node.
  • If this isn't appropriate then you will need to have some sort of voting exchange so the nodes can agree who is active. Something like: http://en.wikipedia.org/wiki/Two-phase_commit_protocol
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文