I am trying to protect my zookeeper with credentials.
Until now i've used the following code in order to connect to zookeeper:
zk = KazooClient(hosts=HOSTS)
zk.start()
Now, in order to add credentials i've added an auth with addauth digest username:password
command and set ACL to the znode with setAcl /znode auth:username:password:crdwa
.
now when I try to connect to the zookeeper server via zkCli I get
kazoo.exceptions.NoAuthError
as excepted.
But how I can pass the auth credentials to the KazooClient
?
I can create ACL credentials with
ACL = make_digest_acl("username", "password", all=True)
CRED = make_digest_acl_credential("username", "password")
and add default_acl
, auth_data
like
zk = KazooClient(hosts=HOSTS, default_acl=ACL, auth_data=[CRED])
but i still cannot connect via python.
How I should authenticate the zookeeper server via kazoo client?
Thank you