use*_*654 28 apache-zookeeper 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.
Run Code Online (Sandbox Code Playgroud)
使用3服务器集合,如果一台服务器退出轮换而一台服务器出现意外中断,则仍有一台服务器应确保不会中断服务.那为什么需要5台服务器?或者它不仅仅是正在考虑的服务中断?
更新:
感谢@sbridges指出它与维持法定人数有关.ZK定义仲裁的方式是整体ceil(N/2)中N的原始数字(而不仅仅是当前可用的集合).
现在,谷歌搜索ZK仲裁在ZK的HBase书籍章节中找到了这个:
在ZooKeeper中,支持偶数个对等体,但通常不使用它,因为偶数大小的集合需要比例更多的对等体形成法定数量而不是奇数大小的集合所需要的.例如,具有4个对等体的集合需要3来形成仲裁,而具有5的集合也需要3来形成仲裁.因此,5的集合允许2个对等体失败并且仍然维持仲裁,因此比4的集合更容错,其仅允许1个向下对等体.
这篇维基百科在Edward J. Yoon 博客中的解释:
通常情况下,这是预期在那里的大多数人,尽管许多机构的法定人数可能更低或更高.
sbr*_*ges 25
Zookeeper要求您具有法定数量的服务器,法定人数ceil(N/2).对于3服务器集合,这意味着2个服务器必须随时启动,对于5个服务器集合,3个服务器需要随时启动.
基本上,只要与失败的 Zookeeper 相比,活跃的 Zookeeper 占多数,Zookeeper 就能正常工作。另外,如果仲裁大小为偶数,即 2、4、6 等,则失败 = 活动,因此不建议这样做。
3 和 4 都只能处理 1 个故障,那么为什么我们要使用 4 个 Zookeeper 而不是 3 个呢?
| 归档时间: |
|
| 查看次数: |
19083 次 |
| 最近记录: |