ZooKeeper的可靠性-3个节点与5个节点 [英] ZooKeeper reliability - three versus five nodes

查看:861
本文介绍了ZooKeeper的可靠性-3个节点与5个节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 ZooKeeper常见问题解答:

Reliability:

A single ZooKeeper server (standalone) is essentially a coordinator with
no reliability (a single serving node failure brings down the ZK service).

A 3 server ensemble (you need to jump to 3 and not 2 because ZK works
based on simple majority voting) allows for a single server to fail and
the service will still be available.

So if you want reliability go with at least 3. We typically recommend
having 5 servers in "online" production serving environments. This allows
you to take 1 server out of service (say planned maintenance) and still
be able to sustain an unexpected outage of one of the remaining servers
w/o interruption of the service.

在三台服务器的组合中,如果将一台服务器从旋转中移出,并且一台服务器发生意外中断,那么仍有一台剩余的服务器应确保不中断服务.那为什么需要5台服务器?还是不仅仅是正在考虑中断服务?

With a 3-server ensemble, if one server is taken out of rotation and one server has an unexpected outage, then there is still one remaining server that should ensure no interruption of service. Then why the need for 5 servers? Or is it more than just interruption of service that is being considered?

更新:

感谢@sbridges指出它与维持仲裁有关. ZK定义仲裁的方式是ceil(N/2),其中N是整体中的原始编号(而不仅仅是当前可用的集合).

Thanks to @sbridges for pointing out that it has to do with maintaining a quorum. And the way that ZK defines a quorum is ceil(N/2) where N is the original number in the ensemble (and not just the currently available set).

现在,通过Google搜索ZK仲裁,可以在HBase的关于ZK的章节中找到该内容:

Now, a google search for ZK quorum finds this in the HBase book chapter on ZK:

在ZooKeeper中,支持的偶数为偶数,但通常是 之所以不使用,是因为均匀的合奏需要按比例分配更多的空间 对等体形成超出奇数大小的合奏所需的法定人数.为了 例如,一个具有4个对等体的合奏需要3个成员以形成法定人数,而 具有5的合奏也需要3才能形成定额.因此,一个合奏 的5个允许2个对等方失败并仍保持仲裁,因此更多 容错性比4的组合更高,后者仅允许1个向下的对等体.

In ZooKeeper, an even number of peers is supported, but it is normally not used because an even sized ensemble requires, proportionally, more peers to form a quorum than an odd sized ensemble requires. For example, an ensemble with 4 peers requires 3 to form a quorum, while an ensemble with 5 also requires 3 to form a quorum. Thus, an ensemble of 5 allows 2 peers to fail and still maintain quorum, and thus is more fault tolerant than the ensemble of 4, which allows only 1 down peer.

爱德华·尤恩(Edward J. Yoon)的博客:

And this paraphrasing of Wikipedia in Edward J. Yoon's blog:

通常,这是预期会在那里的大多数人, 尽管许多机构的法定人数可能更低或更高.

Ordinarily, this is a majority of the people expected to be there, although many bodies may have a lower or higher quorum.

推荐答案

Zookeeper要求您拥有一定数量的服务器,而法定数量为ceil(N/2).对于3个服务器集合,这意味着必须随时启动2台服务器,对于5个服务器集合,则需要随时启动3台服务器.

Zookeeper requires that you have a quorum of servers up, where quorum is ceil(N/2). For a 3 server ensemble, that means 2 servers must be up at any time, for a 5 server ensemble, 3 servers need to be up at any time.

这篇关于ZooKeeper的可靠性-3个节点与5个节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆