main:ZooKeeperServerMain@54 - Invalid arguments, exiting abnormally
Asked Answered
V

2

12

I am new to using Zookeeper and trying to learn it using Zookeeper book. Now to start the server in standalone mode it is given in book as to use the command bin/zkServer.sh start.

I am using Windows so I ran the command as bin/zkServer.cmd start and now I get a strange error as :

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

Can someone please help me in understanding why I am getting this error? The commands has changed from what are mentioned in this Zookeeper book?

After going through this SO post zookeeper not starting I am able to make the zookeeper up by omitting the input start for the command. Is it the correct way of starting a server in standalone mode?

Here is my configuration file for 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
Verticillaster answered 4/4, 2014 at 15:54 Comment(0)
W
36

There may be some changes in the Zookeeper 3.4.6. For this version start the server as shown below:

bin\zkServer.cmd

E.g.

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

Note, you don't need to pass the command line arg "start"

Wastepaper answered 5/4, 2014 at 4:12 Comment(2)
Thanks Nipun, also I am trying to stop the server using bin\zkServer.cmd stop even then also I am getting same error. Can you please tell me how to stop the server? is it using Ctrl+C or is there any other command t use?Verticillaster
I think now it is only way or kill the process from task manager. With Zookeeper 3.4.5 all these start/stop commands should work. Another way is to use admin commands. Basically you need to connect to Zookeeper server and issue the "kill" commands. You may use a telnet client for the same.Wastepaper
A
1

There may be two possibilities

  1. changes in the Zookeeper 3.4.6. For this version start the server as shown below:

bin\zkServer.cmd

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

  1. There may be white spaces in the MyID file eg"1 "[Image link before edit of myid][1] change it to

    "1" Image link after edit of myid

Ami answered 1/7, 2021 at 18:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.