Apache zookeeper 主要内容:ZooKeeperServerMain@54-参数无效,异常退出

Apache zookeeper 主要内容:ZooKeeperServerMain@54-参数无效,异常退出,apache-zookeeper,Apache Zookeeper,我对使用Zookeeper还不熟悉,并试图用书本来学习。现在,要以独立模式启动服务器,书中给出了使用命令bin/zkServer.sh start 我正在使用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\z

我对使用Zookeeper还不熟悉,并试图用书本来学习。现在,要以独立模式启动服务器,书中给出了使用命令
bin/zkServer.sh start

我正在使用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:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2014-04-04 21:00:06,576 [myid:] - INFO  [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2014-04-04 21:00:06,576 [myid:] - INFO  [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2014-04-04 21:00:06,577 [myid:] - WARN  [main:QuorumPeerMain@113] - Either no config or no quorum defined in config, running  in standalone mode
2014-04-04 21:00:06,626 [myid:] - ERROR [main:ZooKeeperServerMain@54] - 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:ZooKeeperServerMain@55] - Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns]
Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns]

D:\zoo\zookeeper-3.4.6>endlocal
有人能帮我理解为什么我会犯这个错误吗?这些命令与本书中提到的有所不同

在阅读了这篇SO文章之后,我可以通过省略命令的输入
start
来创建zookeeper。以独立模式启动服务器是否正确

这是我的zookeeper配置文件:

# 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

Zookeeper 3.4.6中可能有一些变化。 对于此版本,请按如下所示启动服务器:

bin\zkServer.cmd

例如


注意,您不需要传递命令行arg“start”

谢谢Nipun,而且我正在尝试使用
bin\zkServer.cmd stop来停止服务器,即使这样,我也会收到相同的错误。你能告诉我如何停止服务器吗?它使用的是
Ctrl+C
还是其他命令不可用?我认为现在这是唯一的方法,或者从任务管理器中终止进程。在Zookeeper 3.4.5中,所有这些启动/停止命令都应该有效。另一种方法是使用管理命令。基本上,您需要连接到Zookeeper服务器并发出“kill”命令。您可以使用telnet客户端进行同样的操作。
D:\zoo\zookeeper-3.4.6>bin\zkServer.cmd