redo
再次执行之前命令
代码语言:javascript复制Tip: 历史命令的保持是在当前会话中,不论此时是否已经成功连接服务
[zk: localhost:2181(CONNECTED) 20] history
10 - ls
11 - ls /
12 - create /test test
13 - get /test
14 - ls /
15 - close
16 - ls /
17 - connect localhost:2181
18 - ls /
19 - help
20 - history
[zk: localhost:2181(CONNECTED) 21] redo 11
[test, zookeeper]
[zk: localhost:2181(CONNECTED) 22] redo 15
2015-12-03 16:43:43,109 [myid:] - INFO [main:ZooKeeper@684] - Session: 0x151665fb7430004 closed
Not connected
[zk: localhost:2181(CLOSED) 23] 2015-12-03 16:43:43,111 [myid:] - INFO [main-EventThread:ClientCnxn$EventThread@512] - EventThread shut down
[zk: localhost:2181(CLOSED) 23]
[zk: localhost:2181(CLOSED) 23] redo 17
2015-12-03 16:43:51,288 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@5a4a6010
[zk: localhost:2181(CONNECTING) 24] 2015-12-03 16:43:51,309 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2015-12-03 16:43:51,311 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2015-12-03 16:43:51,333 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1235] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x151665fb7430005, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 24]
还有一些关于权限管控和监听的命令在以后深入使用过程中再仔细研究
命令汇总
wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
tar -zxvf zookeeper-3.4.6.tar.gz
cd zookeeper-3.4.6
grep -v "^#" conf/zoo_sample.cfg
cp conf/zoo_sample.cfg conf/zoo.cfg
bin/zkServer.sh start
netstat -ant | grep 2181
bin/zkServer.sh restart
bin/zkServer.sh stop
bin/zkServer.sh status
bin/zkCli.sh
原文地址