gpt4 book ai didi

apache-zookeeper - zookeeper 中的 "observer"节点能否以陈旧的结果响应?

转载 作者:行者123 更新时间:2023-12-04 12:49:13 25 4
gpt4 key购买 nike

这个问题引用https://zookeeper.apache.org/doc/trunk/zookeeperObservers.html

Observers are non-voting members of an ensemble which only hear the results of votes, not the agreement protocol that leads up to them. Other than this simple distinction, Observers function exactly the same as Followers - clients may connect to them and send read and write requests to them. Observers forward these requests to the Leader like Followers do, but they then simply wait to hear the result of the vote. Because of this, we can increase the number of Observers as much as we like without harming the performance of votes.

Observers have other advantages. Because they do not vote, they are not a critical part of the ZooKeeper ensemble. Therefore they can fail, or be disconnected from the cluster, without harming the availability of the ZooKeeper service. The benefit to the user is that Observers may connect over less reliable network links than Followers. In fact, Observers may be used to talk to a ZooKeeper server from another data center. Clients of the Observer will see fast reads, as all reads are served locally, and writes result in minimal network traffic as the number of messages required in the absence of the vote protocol is smaller.



1) 合奏团的无投票权成员 - 投票成员投票什么?

2) 观察者的更新请求如何工作 - 当 ZK 领导者收到更新请求时,它需要法定人数的节点来响应。观察者节点似乎不被视为法定节点。这是否意味着观察者节点在更新方面落后于领导者节点?如果这是真的,它如何确保观察者节点在读取过程中不响应陈旧数据?

3) 观察者的客户端将看到快速读取,因为所有读取都在本地提供,并且写入导致最小的网络流量,因为在没有投票协议(protocol)的情况下所需的消息数量较少 - 来自所有其他节点的读取也将是本地的,因为它们与领导者同步,不是吗?我没有得到关于写入的部分。

这些问题应该有助于理解zookeeper和分布式系统。感谢这些问题的详细答案。提前致谢 !

最佳答案

1) non-voting members of an ensemble - What do the voting members vote on?



整体的典型成员(不是观察员)对由领导者协调的提议变更的成功/失败进行投票。论文 ZooKeeper: Wait-free coordination for Internet-scale systems中对细节进行了进一步的讨论。 .

2) How does an update request work for observers - When a ZK leader gets an update request, it requires a quorum of nodes to respond. Observer nodes seems like is not considered a quorum node. Does that mean an observer node lags behind the leader node for updates? If that is true, how does it ensure that observer nodes do not respond with stale data during reads?



您是正确的,观察者节点不被视为法定人数的必要参与者。一般来说,更新延迟会受到观察者和领导者之间的网络延迟的影响。 (这是否明显取决于特定的外部因素,例如观察者和领导者是否在具有低延迟网络链接的同一数据中心。)

请注意,即使不使用观察者,也不能保证集成中的每个服务器始终是完全最新的。 Consistency Guarantees 上的 Apache ZooKeeper 文档包含此免责声明:

有时,开发人员错误地假设了 ZooKeeper 实际上没有提供的另一种保证。这是:

Simultaneously Consistent Cross-Client Views ZooKeeper does not guarantee that at every instance in time, two different clients will have identical views of ZooKeeper data. Due to factors like network delays, one client may perform an update before another client gets notified of the change. Consider the scenario of two clients, A and B. If client A sets the value of a znode /a from 0 to 1, then tells client B to read /a, client B may read the old value of 0, depending on which server it is connected to. If it is important that Client A and Client B read the same value, Client B should should call the sync() method from the ZooKeeper API method before it performs its read.



然而,ZooKeeper 的客户端永远不会通过从他们已经读取的数据之前的时间点读取陈旧数据来“回到过去”。这是通过将单调递增的事务 ID(称为“zxid”)附加到每个 ZooKeeper 事务来实现的。当 ZooKeeper 客户端与服务器交互时,它会将客户端最后看到的 zxid 与服务器当前的 zxid 进行比较。如果服务器在客户端后面,那么它将不允许该服务器处理客户端的下一次读取。

3) Clients of the Observer will see fast reads, as all reads are served locally, and writes result in minimal network traffic as the number of messages required in the absence of the vote protocol is smaller - Reads from all the other nodes will also be local only because they are in-sync with the leader, no? And I did not get the part about writes.



重要的是要注意,文档中的这一声明是在观察者的一个重要用例的上下文中编写的:多个数据中心部署,不同数据中心之间具有更高的网络延迟。在这个声明中,“本地服务”是指从与客户端位于同一数据中心内的 ZooKeeper 服务器提供服务,因此它不会受到连接到另一个数据中心的较长延迟的影响。对于完整的上下文,这里是完整报价的副本:

In fact, Observers may be used to talk to a ZooKeeper server from another data center. Clients of the Observer will see fast reads, as all reads are served locally, and writes result in minimal network traffic as the number of messages required in the absence of the vote protocol is smaller.

关于apache-zookeeper - zookeeper 中的 "observer"节点能否以陈旧的结果响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41492819/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com