zookeeper server error: My id 4 not in the peer list
Asked Answered
G

3

11

I am trying to install zookeeper and HBase in distributed mode but when I start my last node of zookeeper quorum I am getting excepton:

2013-09-05 12:02:09,230 - ERROR [main:QuorumPeer@171] - Setting LearnerType to   PARTICIPANT but 4 not in QuorumPeers. 
2013-09-05 12:02:09,246 - INFO  [main:QuorumPeer@444] - acceptedEpoch not found!  Creating with a reasonable default of 0. This should only happen when you are upgrading   your installation
2013-09-05 12:02:09,250 - ERROR [main:QuorumPeerMain@89] - Unexpected exception, exiting abnormally
java.lang.RuntimeException: My id 4 not in the peer list
at  org.apache.zookeeper.server.quorum.QuorumPeer.startLeaderElection(QuorumPeer.java:479)
at org.apache.zookeeper.server.quorum.QuorumPeer.start(QuorumPeer.java:411)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.runFromConfig(QuorumPeerMain.java:151)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:111)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:78)

I have zookeeper quorum set to 3 - containing master + 2data nodes from hadoop. zoo.cfg list all those machines. And they have myid set to 1 for master, 3 for first data mode and 4 for second data node. Master and first data node runs just fine.

Gilson answered 6/9, 2013 at 7:44 Comment(1)
2013-09-05 12:02:09,246 - INFO [main:QuorumPeer@444] - acceptedEpoch not found! Creating with a reasonable default of 0. This should only happen when you are upgrading your installation did you see this infoReductive
G
15

Seems it was caused by inconsistency between myid and content of zoo.cfg - when I unified the server. with in myid file that it started with no problem.

Gilson answered 6/9, 2013 at 8:44 Comment(1)
I had the same problem. It was because in zoo.cfg this line didn't have the correct id: server.$myID=_IP_:2888:3888:observerThermidor
L
4

if you are facing this problem in case of Kafka installation then go to zookeeper.properties file and check what is value of myid i.e.

server.<<myid>> = hostname:2181

and same value of myid must be in myid file present in datadir of zoookeer, which in my case is:

/tmp/zookeeper/myid
Lissotrichous answered 17/5, 2018 at 15:34 Comment(0)
H
0

It seems that you are using inconsistent ids in your configuration. In case you are using docker-compose in order to run and deploy zookeeper cluster, the configuration should looks like as below:

version: '<version>'
services:
  zookeeper:
    image: zookeeper:<zookeeper_version>
    hostname: <zookeeper-name>
    container_name: <zookeeper-container-name>
    ports:
      - "8080:8080"
      - "2181:2181"
      - "3888:3888"
      - "2888:2888"
    environment:
      ZOO_MY_ID: <the-id>
      ZOO_SERVERS: server.<the-id>=0.0.0.0:2888:3888;2181 server.<other-ids>=<other-ips>:2888:3888;2181  
      ZOO_LOG4J_PROP: "INFO,ROLLINGFILE"
      ZOO_4LW_COMMANDS_WHITELIST:  "*"
    volumes:
      - ./data/zookeeper_data:/data
      - ./data/zookeeper_data_log:/datalog
    logging:
      driver: "json-file"
      options:
        max-size: "10m"
        max-file: "3"

In the above example <the-id> must be the same (in both ZOO_SERVERS and ZOO_MY_ID environment variables).

Heterotopia answered 20/12, 2022 at 11:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.