2
votes

Client authentication and ACL permissions to znode of zookeeper?

when client connect to zookeeper then create znode with ACL property (i.e Ids.AUTH_IDS) so now how authentication user only access to get the data form znode of zookeeper ?

1

1 Answers

4
votes

zookeeper command line:

you must execute "addauth" command first when you access to the path that has been setAcl.

addauth digest u1:p1

in zookeeper client you must run addAuthInfo api first.

    try {
        ZooKeeper zk = new ZooKeeper("ip:2181", 10000, null);
        String auth = "u1:p1";
        zk.addAuthInfo("digest", auth.getBytes());
        zk.getChildren("/data", null);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (KeeperException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }