Four. JAVA API of Zookeeper

  1. Create a session

    The client can connect to the ZooKeeper server by creating a ZooKeeper instance. The four construction methods of Zookeeper are as follows:

new ZooKeeper(connectString, sessionTimeout, watcher)

        new ZooKeeper(connectString, sessionTimeout, watcher, canBeReadOnly)

        new ZooKeeper(connectString, sessionTimeout, watcher, sessionId, sessionPasswd)

        new ZooKeeper(connectString, sessionTimeout, watcher, sessionId, sessionPasswd, canBeReadOnly)

    

 

  1. create node

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325506863&siteId=291194637