Created
June 11, 2020 04:31
-
-
Save velotiotech/d01f0ddf9b30bdf800cd85b9d3afd659 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kazoo.client import KazooClient | |
zk = KazooClient(hosts='leader.mesos:2181', read_only=True) | |
zk.start() | |
clusterId = "" | |
# Here we can give znode path to retrieve its decoded data, | |
# for ex to get cluster-id, use | |
# data, stat = zk.get("/cluster-id") | |
# clusterId = data.decode("utf-8") | |
# Get cluster Id | |
if zk.exists("/cluster-id"): | |
data, stat = zk.get("/cluster-id") | |
clusterId = data.decode("utf-8") | |
zk.stop() | |
print (clusterId) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment