问题
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