【发布时间】:2012-10-12 21:37:32
【问题描述】:
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 定义 quorum 的方式是 ceil(N/2),其中 N 是集合中的原始数字(而不仅仅是当前可用的集合)。
现在,谷歌搜索 ZK quorum 在 HBase 书籍 chapter on ZK 中找到了这个:
在 ZooKeeper 中,支持偶数个对等点,但通常是 没有使用,因为一个均匀大小的合奏需要,按比例,更多 同龄人组成的法定人数超过了奇数规模的合奏所需的人数。为了 例如,一个有 4 个对等点的 ensemble 需要 3 个来形成一个仲裁,而 一个 5 人的合奏也需要 3 人才能形成一个法定人数。于是,一个合奏 5 允许 2 个对等方失败并仍然保持仲裁,因此更多 比 4 的 ensemble 容错,它只允许 1 个 down peer。
还有 Edward J. Yoon 的 blog 中对 Wikipedia 的解释:
通常情况下,大多数人预计会在那里, 尽管许多团体的法定人数可能较低或较高。
【问题讨论】:
-
什么是“计划维护”的例子?
标签: zookeeper apache-zookeeper