2014-04-04 61 views
5

我是使用Zookeeper並嘗試使用Zookeeper書籍學習它的新手。現在以獨立模式啓動服務器,在書中給出使用命令bin/zkServer.sh startmain:ZooKeeperServerMain @ 54 - 無效參數,異常退出

我使用Windows,所以我跑了命令bin/zkServer.cmd start,現在我得到一個奇怪的錯誤爲:

D:\zoo\zookeeper-3.4.6>bin\zkServer.cmd start 

D:\zoo\zookeeper-3.4.6>java "-Dzookeeper.log.dir=D:\zoo\zookeeper-3.4.6\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "D:\zoo\zookeeper-3.4.6\bin\..\build\classes;D:\zoo\zookeeper-3.4.6\bin\..\b 
ild\lib\*;D:\zoo\zookeeper-3.4.6\bin\..\*;D:\zoo\zookeeper-3.4.6\bin\..\lib\*;D:\zoo\zookeeper-3.4.6\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zoo\zookeeper-3.4.6\bin\..\conf 
zoo.cfg" start 
2014-04-04 21:00:06,573 [myid:] - INFO [main:[email protected]] - autopurge.snapRetainCount set to 3 
2014-04-04 21:00:06,576 [myid:] - INFO [main:[email protected]] - autopurge.purgeInterval set to 0 
2014-04-04 21:00:06,576 [myid:] - INFO [main:[email protected]] - Purge task is not scheduled. 
2014-04-04 21:00:06,577 [myid:] - WARN [main:[email protected]] - Either no config or no quorum defined in config, running in standalone mode 
2014-04-04 21:00:06,626 [myid:] - ERROR [main:[email protected]] - Invalid arguments, exiting abnormally 
java.lang.NumberFormatException: For input string: "D:\zoo\zookeeper-3.4.6\bin\..\conf\zoo.cfg" 
     at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) 
     at java.lang.Integer.parseInt(Integer.java:449) 
     at java.lang.Integer.parseInt(Integer.java:499) 
     at org.apache.zookeeper.server.ServerConfig.parse(ServerConfig.java:60) 
     at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:83) 
     at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:52) 
     at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:116) 
     at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78) 
2014-04-04 21:00:06,629 [myid:] - INFO [main:[email protected]] - Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns] 
Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns] 

D:\zoo\zookeeper-3.4.6>endlocal 

可有人請幫助我理解爲什麼我收到這個錯誤?這個命令已經從這個Zookeeper書中提到的改變了嗎?

通過此SO帖子zookeeper not starting後,我可以通過省略命令輸入start使動物園管理員。這是在獨立模式下啓動服務器的正確方法嗎?

這裏是動物園管理員我的配置文件:

# The number of milliseconds of each tick 
tickTime=2000 
# The number of ticks that the initial 
# synchronization phase can take 
initLimit=10 
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement 
syncLimit=5 
# the directory where the snapshot is stored. 
# do not use /tmp for storage, /tmp here is just 
# example sakes. 
#dataDir=/tmp/zookeeper 
dataDir=D:\dataDir 
# the port at which the clients will connect 
clientPort=2181 
# the maximum number of client connections. 
# increase this if you need to handle more clients 
#maxClientCnxns=60 
# 
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge. 
# 
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance 
# 
# The number of snapshots to retain in dataDir 
#autopurge.snapRetainCount=3 
# Purge task interval in hours 
# Set to "0" to disable auto purge feature 
#autopurge.purgeInterval=1 

回答

17

有可能是在動物園管理員3.4.6一些變化。 對於此版本啓動服務器如下圖所示:

斌\ zkServer.cmd

例如

D:\zoo\zookeeper-3.4.6>bin\zkServer.cmd 

注意,你並不需要通過命令行參數「開始」

+0

感謝Nipun,也是我試圖使用'斌\ zkServer.cmd stop'即使這樣我也停止服務器我得到同樣的錯誤。你能告訴我如何停止服務器?它是使用「Ctrl + C」還是有其他命令使用? – Chaitanya

+0

我想現在只有這樣或者從任務管理器中殺死進程。通過Zookeeper 3.4.5,所有這些啓動/停止命令都可以工作。另一種方法是使用管理員命令。基本上你需要連接到Zookeeper服務器併發出「kill」命令。您可以使用同樣的telnet客戶端。 –