How to get Stats of a Zookeeper node using Curator framework

最后都变了- 提交于 2019-12-11 02:19:35

问题


I am using curator framework in java to interact with ZNodes. How do we get node stats like last_modified time and creation time etc. I could do same in python using kazoo framework.

from kazoo.client import KazooClient

zk_client = KazooClient(hosts='127.0.0.1:2181')
zk_client.start()
data, stat = zk_client.get("/my/favorite")

Ref. Link: kazoo

I tried searching similar support via curator and couldn't get result. Kindly help here. Thanks.


回答1:


Curator (note I'm the main author of Curator) wraps the standard ZooKeeper Java API so all the same methods are there. So, to get the Stat object:

CuratorFramework client = ....
Stat stat = client.checkExists().forPath(path);


来源:https://stackoverflow.com/questions/39728153/how-to-get-stats-of-a-zookeeper-node-using-curator-framework

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