ZooKeeper可靠性 – 三到五个节点

ZooKeeper FAQ

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.

使用3服务器集合,如果一个服务器停止旋转,并且一个服务器出现意外中断,则仍然有一个剩余的服务器应确保不会中断服务。那为什么需要5台服务器?还是不仅仅是正在考虑的服务中断?

更新:

感谢@sbridges指出它与维护法定人数有关。而ZK定义法定人数的方式是ceil(N / 2),其中N是合奏中的原始数字(而不仅仅是当前可用的集合)。

现在,谷歌搜索ZK法定人数可以在HBase书chapter on ZK中找到:

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的blog

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

Zookeeper要求您有一个服务器的数量,其中quorum是ceil(N / 2)。对于3个服务器集合,这意味着2个服务器必须随时启动,对于5个服务器组合,3个服务器需要随时启动。
相关文章
相关标签/搜索