# 我们通过另一个zk客户端连接到Docker容器的zk服务端
$ ./zkCli.sh -server 10.10.1.167:2181
Connecting to 10.10.1.167:2181
2016-09-01 14:32:42,398 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
2016-09-01 14:32:42,402 [myid:] - INFO [main:Environment@100] - Client environment:host.name=localhost
2016-09-01 14:32:42,402 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.7.0_79
2016-09-01 14:32:42,405 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2016-09-01 14:32:42,405 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/Users/yunyu/dev/zookeeper-3.4.8/bin/../build/classes:/Users/yunyu/dev/zookeeper-3.4.8/bin/../build/lib/*.jar:/Users/yunyu/dev/zookeeper-3.4.8/bin/../lib/slf4j-log4j12-1.6.1.jar:/Users/yunyu/dev/zookeeper-3.4.8/bin/../lib/slf4j-api-1.6.1.jar:/Users/yunyu/dev/zookeeper-3.4.8/bin/../lib/netty-3.7.0.Final.jar:/Users/yunyu/dev/zookeeper-3.4.8/bin/../lib/log4j-1.2.16.jar:/Users/yunyu/dev/zookeeper-3.4.8/bin/../lib/jline-0.9.94.jar:/Users/yunyu/dev/zookeeper-3.4.8/bin/../zookeeper-3.4.8.jar:/Users/yunyu/dev/zookeeper-3.4.8/bin/../src/java/lib/*.jar:/Users/yunyu/dev/zookeeper-3.4.8/bin/../conf:
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/Users/yunyu/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/var/folders/0h/jtjrr7g95mv2pt4ts1tgmzyh0000gn/T/
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Mac OS X
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=x86_64
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:os.version=10.11.5
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:user.name=yunyu
2016-09-01 14:32:42,406 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/Users/yunyu
2016-09-01 14:32:42,407 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/Users/yunyu/dev/zookeeper-3.4.8/bin
2016-09-01 14:32:42,408 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=10.10.1.167:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@3823ed31
Welcome to ZooKeeper!
2016-09-01 14:32:42,441 [myid:] - INFO [main-SendThread(10.10.1.167:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server 10.10.1.167/10.10.1.167:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2016-09-01 14:32:42,453 [myid:] - INFO [main-SendThread(10.10.1.167:2181):ClientCnxn$SendThread@876] - Socket connection established to 10.10.1.167/10.10.1.167:2181, initiating session
2016-09-01 14:32:42,492 [myid:] - INFO [main-SendThread(10.10.1.167:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server 10.10.1.167/10.10.1.167:2181, sessionid = 0x156e4682ae30000, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: 10.10.1.167:2181(CONNECTED) 0]
# 查看znode节点
[zk: 10.10.1.167:2181(CONNECTED) 0] ls
[zookeeper]
# 创建新的znode节点,关联到"my_data"
[zk: 10.10.1.167:2181(CONNECTED) 3] create /zk_test my_data
Created /zk_test
[zk: 10.10.1.167:2181(CONNECTED) 4] ls /
[zookeeper, zk_test]