記錄過程當中踩過的坑html
官網下載網址java
dataDir=E:\\Develop\\zookeeper\\3.4.6\\zookeeper-3.4.6\\data dataLogDir=E:\\Develop\\zookeeper\\3.4.6\\zookeeper-3.4.6\\log
PS E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6> .\bin\zkServer.cmd E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6>java "-Dzookeeper.log.dir=E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\build\classes;E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\build\lib\*;E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\*;E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\lib\*;E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\conf\zoo.cfg" 2019-03-11 14:00:09,828 [myid:] - INFO [main:QuorumPeerConfig@103] - Reading configuration from: E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\conf\zoo.cfg 2019-03-11 14:00:09,834 [myid:] - ERROR [main:QuorumPeerMain@85] - Invalid config, exiting abnormally org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\bin\..\conf\zoo.cfg at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:123) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:101) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78) Caused by: java.lang.IllegalArgumentException: dataLogDir E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6\log is missing. at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:253) at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:119) ... 2 more Invalid config, exiting abnormally E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6>endlocal
啓動命令:apache
PS E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6> .\bin\zkServer.cmd
啓動無異常信息session
客戶端鏈接命令:socket
PS E:\Develop\zookeeper\3.4.6\zookeeper-3.4.6> .\bin\zkCli.cmd -server 127.0.0.1:2181
命令行窗口顯示:ui
[zk: 127.0.0.1:2181(CONNECTING) 0]
進行查詢操做:命令行
ls / 2019-03-11 14:26:11,279 [myid:] - INFO [main-SendThread(0:0:0:0:0:0:0:1:2181):ClientCnxn$SendThread@1096] - Client session timed out, have not heard from server in 15001ms for sessionid 0x0, closing socket connection and attempting reconnect Exception in thread "main" org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for / at org.apache.zookeeper.KeeperException.create(KeeperException.java:99) at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1472) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1500) at org.apache.zookeeper.ZooKeeperMain.processZKCmd(ZooKeeperMain.java:720) at org.apache.zookeeper.ZooKeeperMain.processCmd(ZooKeeperMain.java:588) at org.apache.zookeeper.ZooKeeperMain.executeLine(ZooKeeperMain.java:360) at org.apache.zookeeper.ZooKeeperMain.run(ZooKeeperMain.java:323) at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:282)
查詢報錯,由於是剛安裝的,因此確認不會有什麼問題,重啓過服務以後再次嘗試,響應正常code
[zk: localhost:2181(CONNECTED) 1] ls / [zookeeper]