Tuesday, October 18, 2016

Zookeeper not starting

When you want to start zookeeper for the 1st time ,it does not start and does not give any error message.
At those times start zookeper with

./zkServer.sh start-foreground

This will bring the error into console. In my case error was

Using config: /home/myuser/zookeeper/bin/../conf/zoo.cfg
2016-10-18 12:25:54,423 - INFO  [main:QuorumPeerConfig@90] - Reading configuration from: /home/myuser/zookeeper/bin/../conf/zoo.cfg
2016-10-18 12:25:54,429 - INFO  [main:QuorumPeerConfig@310] - Defaulting to majority quorums
2016-10-18 12:25:54,431 - FATAL [main:QuorumPeerMain@83] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /home/myuser/zookeeper/bin/../conf/zoo.cfg
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:110)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:99)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:76)
Caused by: java.lang.IllegalArgumentException: /data/zookeeper/myid file is missing
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:320)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:106)
... 2 more
Invalid config, exiting abnormally


It states "/data/zookeeper/myid file is missing"
Every zookeeper instance must announce its identity.

From Apache documentation :

server.x=[hostname]:nnnnn[:nnnnn], etc
(No Java system property)

servers making up the ZooKeeper ensemble. When the server starts up, it determines which server it is by looking for the file myid in the data directory. That file contains the server number, in ASCII, and it should match x in server.x in the left hand side of this setting.


It means we must open a file as myid data folder and for a config like below

server.1=m2.mydomain.com:2888:3888
server.2=m3.mydomain.com:2888:3888
server.3=m5.mydomain.com:2888:3888

we must open myid for m2.mydomain and write just 1 into it.

No comments:

Post a Comment