Akshay
Akshay

Reputation: 1371

How to get Stats of a Zookeeper node using Curator framework

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.

Upvotes: 2

Views: 2316

Answers (1)

Randgalt
Randgalt

Reputation: 2956

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);

Upvotes: 6

Related Questions