what does 2n + 1 quorum mean?

旧街凉风 提交于 2020-01-13 10:22:16

问题


I've come across this when describing the Zookeeper configuration for HBase, and I'm unfamiliar with the term. Does the 'N' have anything to do with the number of nodes in my HBase cluster? Or the number of nodes I should use in my Zookeeper cluster?


回答1:


2f+1 refers to the level of reliability/availablility you require, in general it is not related to performance.

ZooKeeper ensembles (serving clusters) are made up of one or more servers which "vote" on each change. A majority of the original servers are required to "approve" any change before it's accepted. Clients (hbase in this case) connect to the ensemble and use it to coordinate. If the ensemble is up the clients can do this, if the ensemble is down then hbase is unable to use the service.

Say you have 3 servers (f=1) in the ensemble, if one fails the service is still up (2 is a majority). However if a second server fails the service would be down.

Say you have 5 servers (f=2) in the ensemble. In this case two servers can fail (3 is a majority) and the service is still up.

Typically 3 servers is more than sufficient. However for online production serving environments I'd suggest 5. Why? Say you take 1 server down for scheduled maintenance. If you have 5 servers you can stay up even if one of the remaining active servers fails unexpectedly.

Why not have 101 servers then? -- TANSTAAFL. See the graph here. ZK is a quorum based service. As the number of servers increases the write performance actually drops. More servers are required to participate in the quroum process (voting). As a result the write ops/sec decreases. (read is uneffected though).




回答2:


n refers to the number of failures that the system can experience but still be able to function with at least a majority of nodes. Two examples:

n = 1 - one node can fail out of a total of 2n+1 = 3 nodes

n = 2 - two nodes can fail out of a total of 2n+1 = 5 nodes

And so on!



来源:https://stackoverflow.com/questions/4228227/what-does-2n-1-quorum-mean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!