Zookeeper - three nodes and nothing but errors
Asked Answered
P

3

20

I have three zookeeper nodes. All ports are open. The ip address are correct. Below is my config file. All nodes where booted by chef and all have the same install and config file.

# The number of milliseconds of each tick
tickTime=3000
# 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.
dataDir=/var/lib/zookeeper
# Place the dataLogDir to a separate physical disc for better performance
# dataLogDir=/disk2/zookeeper

# the port at which the clients will connect
clientPort=2181

server.1=111.111.111:2888:3888
server.2=111.111.112:2888:3888
server.3=111.111.113:2888:3888

Here is error for one of the nodes. So...I am rather confused on how I could get an error since the config is rather vanilla. All three nodes are doing hte same thing.

2012-07-16 05:16:57,558 - INFO  [main:QuorumPeerConfig@90] - Reading configuration from: /etc/zookeeper/conf/zoo.cfg
2012-07-16 05:16:57,567 - INFO  [main:QuorumPeerConfig@310] - Defaulting to majority quorums
2012-07-16 05:16:57,572 - FATAL [main:QuorumPeerMain@83] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing /etc/zookeeper/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: serverid replace this text with the cluster-unique zookeeper's instance id (1-255) is not a number
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:333)
    at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:106)
    ... 2 more
Physical answered 16/7, 2012 at 5:22 Comment(0)
C
41

You need create a file named myid and put it into zookeeper var directory, one for each server, consists of a single line containing only the text of that machine's id. So myid of server 1 would contain the text "1" and nothing else. The id must be unique within the ensemble and should have a value between 1 and 255.

see more at http://zookeeper.apache.org/doc/r3.3.3/zookeeperAdmin.html#sc_zkMulitServerSetup

Cisalpine answered 16/7, 2012 at 5:36 Comment(2)
Oh...got it. Where do you place tat file? /etc/zookeeper/conf?Physical
You place the file in the location identified by the "dataDir" property in zookeeper.properties (which, in turn, is the file you pass as an argument when starting ZooKeeper). In your config file above, your dataDir is /var/lib/zookeeper, so the file should be /var/lib/zookeeper/myid.Braca
H
5
server.1=111.111.111:2888:3888
server.2=111.111.112:2888:3888
server.3=111.111.113:2888:3888

Are your servers and IP's

Then create myid file on each of the nodes with value 1 in 111.111.111 and 2 in 111.111.111.112 and 3 in 111.111.111.113 servers under directory(dataDir=/var/lib/zookeeper)

If you place value "1" myid file you will get Number format exception and "Invalid config, exiting abnormally" if the myid file is created with any extension.

Therefore just create myid file without any extension and place integer values 1,2,3 in the corresponding servers without double quotes

Hemorrhoidectomy answered 7/8, 2016 at 14:56 Comment(0)
G
0

While creating the myid, you should check the command, don't use extra space

Invalid Command (After 1 it is extra space that many cause for Exception echo 1 >>/tmp/zookeeper-1/myid

Valid Command echo 1>>/tmp/zookeeper-1/myid

Ganges answered 2/12, 2023 at 13:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.