英文:
curator sharedvalue persistency
问题
我正在使用Curator框架的sharedValue配方进行一些测试。
我找不到关于对象持久性如何在Zookeeper端保留的信息。
我在问这个是因为我认为它们默认情况下是“持久的”,但在Zookeeper的所有节点发生重启后,值似乎又变成了空的。
可能是代码上的错误,不用担心,但我想知道我是否正确地认为sharedValue对象在默认情况下会使事物“持久化”,并且在使用正确版本创建和更新对象之后(我看到其他节点如果注册了监听器会得到更新),我是否应该完成,或者我有遗漏的内容。
英文:
i was doing some test with sharedValue recipe from Curator framework.
I can't find info on how persistence of objects it's kept on zookeeper side.
i am asking that cos i think they are "persistent" out of the box, but after a major restart of all nodes of zookeeper the value seems to be back to empty.
Probably a mistake on code, nothing to be worried about, but i wonder if i am correct assuming that sharedValue object make things "persistent" out of the box, and after creating & updating one with the proper version (i see that other nodes get updated if they register a lsitener) i should be done or i am loosing something
答案1
得分: 1
你可以在 SharedValue 的源代码中看到(https://github.com/apache/curator/blob/master/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L256),节点是使用 Curator 的默认设置创建的,即持久节点。因此,我不确定在你的设置中发生了什么,但使用这个方案,节点是持久的。
英文:
You can see in the source code for SharedValue (https://github.com/apache/curator/blob/master/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L256) that the node is created with Curator's default which is persistent. So, I'm not sure what happened in your setup but the node is persistent with this recipe.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论