2016-06-2819:29:18,074 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=192.168.229.160:2181,192.168.229.161:2181,192.168.229.162:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@770537e4 Welcome to ZooKeeper! 2016-06-2819:29:18,146 [myid:] - INFO [main-SendThread(192.168.229.162:2181):ClientCnxn$SendThread@975] - Opening socket connection to server 192.168.229.162/192.168.229.162:2181. Will not attempt to authenticate using SASL (unknown error) JLine support is enabled 2016-06-2819:29:18,161 [myid:] - INFO [main-SendThread(192.168.229.162:2181):ClientCnxn$SendThread@852] - Socket connection established to 192.168.229.162/192.168.229.162:2181, initiating session 2016-06-2819:29:18,199 [myid:] - INFO [main-SendThread(192.168.229.162:2181):ClientCnxn$SendThread@1235] - Session establishment complete on server 192.168.229.162/192.168.229.162:2181, sessionid = 0x3557c39d2810029, negotiated timeout = 30000
执行此命令,客户端成功连接上zk,会有类似以下的输出,其中,包括“Welcome to ZooKeeper!”的欢迎语,以及其他一些连接的信息等。
lihaodeMacBook-Pro:bin lihao$ ./zkCli.sh -server 127.0.0.1:2182Connecting to 127.0.0.1:21822016-06-2907:51:39,679 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/201603:18GMT 2016-06-2907:51:39,682 [myid:] - INFO [main:Environment@100] - Client environment:host.name=192.168.31.1072016-06-2907:51:39,682 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_772016-06-2907:51:39,684 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation …… 2016-06-2907:51:39,686 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=127.0.0.1:2182 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@531d72ca Welcome to ZooKeeper! 2016-06-2907:51:39,715 [myid:] - INFO [main-SendThread(127.0.0.1:2182):ClientCnxn$SendThread@1032] - Opening socket connection to server 127.0.0.1/127.0.0.1:2182. Will not attempt to authenticate using SASL (unknown error) JLine support is enabled 2016-06-2907:51:39,797 [myid:] - INFO [main-SendThread(127.0.0.1:2182):ClientCnxn$SendThread@876] - Socket connection established to 127.0.0.1/127.0.0.1:2182, initiating session [zk:127.0.0.1:2182(CONNECTING) 0] 2016-06-2907:51:39,830 [myid:] - INFO [main-SendThread(127.0.0.1:2182):ClientCnxn$SendThread@1299] - Session establishment complete on server 127.0.0.1/127.0.0.1:2182, sessionid = 0x155996605050000, negotiated timeout = 30000