gpt4 book ai didi

apache-zookeeper - Zookeeper 临时节点是否写入磁盘?

转载 作者:行者123 更新时间:2023-12-04 07:28:07 26 4
gpt4 key购买 nike

Zookeeper 临时节点是否写入磁盘?

我知道在 Zookeeper 确认写入客户端之前,正常的 Zookeeper 节点已写入磁盘。

但是,临时节点仅在客户端 session 期间持续,因此如果 Zookeeper 节点都崩溃了,那么根据定义,客户端 session 将中断。因此无需写入磁盘,因为在集成重新启动时不会重新创建临时节点。所以理论上似乎临时节点只需要存储在内存中。

这是它的实现方式吗?

最佳答案

我自己遇到了这个问题,并注意到它已经在 Zookeeper mailing list 上得到了回答。 ,我把它贴在这里给任何发现这个问题的人。

简而言之,是的,临时节点确实写入了磁盘。因此,即使整个 Zookeeper 集合关闭,客户端 session 也可以持续存在。报价 Patrick Hunt's answer from the mailing list (强调我的):

Ephemeral znodes are treated just like persistent znodes in the sense that a quorum of nodes need to agree to any change. As such the znode is written to the transaction log.

A client session ends either when a client closes it's session explicitly or the ZK quorum leader decides that the session has expired (which is based on the negotiated session timeout). Only while a leader is active can a session be expired (or closed for that matter). When you shutdown an ensemble the sessions are maintained. If you were to, for example, shut down an ensemble for an hour and then restart it the sessions would still be active. The clock would "reset" when the new leader was elected. If the client session is still active the session would continue, any ephemeral znodes would still exist.

关于apache-zookeeper - Zookeeper 临时节点是否写入磁盘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48159683/

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