I was wondering if there is a way in the kazoo library for zookeeper to create the chroot path in the connection string if the path doesn't already exist? Does anyone have experience with this? I've read the docs, but I haven't really found anything to deal with this.
What I'm doing now is connecting to the zookeeper server, making sure the path exists, disconnecting, and then reconnecting with the path, but that doesn't seem very efficient.
connection1 = '127.0.0.102:2181,127.0.0.213:2181,127.0.0.134:2181'
connection2 = '127.0.0.102:2181,127.0.0.213:2181,127.0.0.134:2181/pathtoroot'
zk = KazooClient(hosts=connection1, timeout=2.0)
zk.start()
zk.ensure_path(pathtoroot)
zk.stop()
zk = KazooClient(hosts=connection2, timeout=2.0)
zk.start()
Thank you!