zookeeper not starting

2019-04-03 06:36发布

问题:

i'm working with zookeeper (http://zookeeper.apache.org/). downloaded 3.3.5 and create zoo.cfg and placed in $ZOOKEEPER/conf, started the zookeeper using zkServer start. but following is the error

can any please help me here ..

 nfig or no quorum defined in config, running  in standalone mode
 2012-08-01 23:20:32,175 [myid:] - ERROR [main:ZooKeeperServerMain@54] - Invalid
 arguments, exiting abnormally
 java.lang.NumberFormatException: For input string: "C:\Development\apps\zookeeper\zookeeper3.4.1\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)
 2012-08-01 23:20:32,177 [myid:] - INFO  [main:ZooKeeperServerMain@55] - Usage: Z
 ooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns]
 Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns]

回答1:

just omit the "start" parameter and call "bin\zkServer" instead.



回答2:

java.lang.NumberFormatException: For input string: "C:\Development\apps\zookeeper\zookeeper3.4.1\bin..\conf\zoo.cfg"

It seems you run the zkServer with the "start" and the location of the zoo.cfg file, namely, "C:\Development\apps\zookeeper\zookeeper3.4.1\bin..\conf\zoo.cfg", and another parameter, which adds up to 3 parameters:

./zkServer start C:\Development\apps\zookeeper\zookeeper3.4.1\bin..\conf\zoo.cfg xxx

So, the problem can be solved by simply remove the second and third parameter, which makes the command to:

./zkServer start

The reason behind this is because the classes(QuorumPeerMain, ZooKeeperServerMain) zkServer uses to initialize the zookeeper system accept various number of parameters and behave accordingly. When you feed two parameters to zkServer, the meaning behind the two parameters supposed to be port and datadir. Yeah, port should be a number, and here comes your bomb.

BTW, the bootstrap scripts are coming with help instructions when you execute them without any para.



回答3:

In zoo.cfg file goto dataDir=/usr/zookeeper/data

In data folder create a file with name myid and write 1. Save the file and start zkServer

If you are running multiple instances, for every instance you need to create myid file in data folder and write with 1,2,3 respectively. Actually this is used for node leader election.