2n + 是什么意思? 1法定人数意味着什么?
我在描述 HBase 的 Zookeeper 配置时遇到过这个问题,但我对这个术语并不熟悉。 “N”与我的 HBase 集群中的节点数量有关系吗?或者我应该在 Zookeeper 集群中使用的节点数量?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
2f+1是指您需要的可靠性/可用性级别,一般与性能无关。
ZooKeeper 集群(服务集群)由一台或多台服务器组成,它们对每个更改进行“投票”。大多数原始服务器都需要“批准”任何更改才能被接受。客户端(在本例中为 hbase)连接到整体并使用它进行协调。如果 ensemble 启动,客户端可以执行此操作,如果 ensemble 关闭,则 hbase 无法使用该服务。
假设集合中有 3 台服务器 (f=1),如果其中一台出现故障,服务仍会运行(2 台占多数)。但是,如果第二台服务器出现故障,服务就会停止。
假设集合中有 5 台服务器 (f=2)。在这种情况下,两台服务器可能会发生故障(大多数是 3 台),而服务仍然正常运行。
通常 3 台服务器就足够了。然而,对于在线生产服务环境,我建议 5。为什么?假设您关闭 1 台服务器进行定期维护。如果您有 5 台服务器,即使剩余的活动服务器之一意外发生故障,您也可以保持运行。
那么为什么不拥有 101 台服务器呢? ——坦斯塔夫。请参见此处的图表。 ZK 是一种基于仲裁的服务。随着服务器数量的增加,写入性能实际上会下降。需要更多服务器参与仲裁过程(投票)。结果,每秒写入操作数减少。 (但读取不受影响)。
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).
n
指的是系统可能遇到的故障数量,但仍然能够与至少大多数节点一起运行。两个示例:n = 1
- 总共2n+1 = 3
个节点中,一个节点可能会发生故障n = 2
- 两个节点可能会发生故障总共2n+1 = 5
个节点失败等等!
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 of2n+1 = 3
nodesn = 2
- two nodes can fail out of a total of2n+1 = 5
nodesAnd so on!