Install the prerequisites. Below works for Debian-based distros such as Ubuntu/Mint:
apt-get install libzookeeper-mt-dev
Install python libraries:
pip install zkpython pykeeper
Example code below shows making a connection, getting the names of some child nodes and pulling info from each of those child nodes:
import pykeeper import json client = pykeeper.ZooKeeper('192.168.1.2:2181') client.connect() coords = client.get_children('/druid/coordinator/_COORDINATOR') list_of_coord_addresses =  for coord in coords: zk_coord = client.get('/druid/coordinator/_COORDINATOR/%s' % coord ) list_of_coord_addresses.append(zk_coord) print(list_of_coord_addresses)
Unfortunately I can’t get this installed on CentOS.