概念
-
Apache ZooKeeper: A Distributed Coordination Service for Distributed Applications
![](https://img.haomeiwen.com/i2180450/89f9a16e95077223.png)
上述图片引自ZooKeeper官网
策略
只有过半节点可用集群才可用!
节点数 | 最少可用节点数 | 容忍失效节点数 |
---|---|---|
1 | 1 | 0 |
2 | 2 | 0 |
3 | 2 | 1 |
4 | 3 | 1 |
5 | 3 | 2 |
6 | 4 | 2 |
- 偶数节点数的集群效率和比它小1的奇数相同 因此集群最佳节点数等于>=3的奇数
为什么要求必须过半节点可用?
![](https://img.haomeiwen.com/i2180450/03356272d6222e6b.png)
- 如果最少可用节点数=3 那么机房间临时网络中断会导致两个Leader产生 即发生脑裂Split Brain
网友评论