58

I have written a kafka consumer and producer that worked fine until today. This morning, when I started zookeeper and kafka, my consumer was not able to read messages, and I found this in the zookeeper logs:

INFO Got user-level KeeperException when processing sessionid:0x151c41e62e10000 
     type:create cxid:0x2a zxid:0x1e txntype:-1 reqpath:n/a 
     Error Path:/brokers/ids 
     Error:KeeperErrorCode = NodeExists for /brokers/ids   
     (org.apache.zookeeper.server.PrepRequestProcessor)
Donald S
  • 1,583
  • 1
  • 10
  • 26
adellarocca
  • 649
  • 1
  • 5
  • 7
  • Looks like you are trying to start another kafka broker with same broker id – vasa.v03 Dec 21 '15 at 11:05
  • Thank you. It's very strange. I follow the same procedure of other times. What thing could' I try to fix the problem? – adellarocca Dec 21 '15 at 11:24
  • Try restarting zookeeper followed by kafka once – vasa.v03 Dec 21 '15 at 11:33
  • 2
    Got the same issue, restarting nodes is ok, Kafka doesn't log anything, only zookeeper is complaining, yet the consumers can't subscribe. – bric3 Mar 22 '16 at 13:26
  • 4
    Faced the same issue. Had to clear all logs and zookeeper files to fix this. – Rahar Apr 25 '16 at 08:52
  • plzz provide more details about your problem – Panagiotis Drakatos Jul 20 '16 at 22:03
  • @Rahar: Your solution worked for me... :) But this issue eaten up my whole day... :( I **deleted all files** from `'/tmp/zookeeper'` and `'/tmp/kafka-logs'` .... and my consumers are again able to process messages.. – Chaitanya Jul 12 '17 at 14:28
  • 2
    Could you provide your Kafka server version, Zookeeper version, Kafka-client version? Can you also give the topic information and metadata of the given topic/partitions. – Irshad P I Sep 10 '19 at 19:25

3 Answers3

18

Look for log.dirs in your server.properties file and delete all the Kafka and zookeeper logs from there and try restarting zookeeper and Kafka respectively. I was facing the same issue and doing this resolved it.

Alok Mishra
  • 926
  • 13
  • 39
0

I want to add extra information: I was trying to set up Kafka with Zookeeper on Windows and also with Docker Compose - faced the same issue.

I realize that the Kafka node needs to wait for Zookeeper for about 20-30 seconds before it could start successfully. So my batch script on Windows would be: REM first cd to the Kafka root folder

@echo off
start cmd /k ".\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties"
timeout /t 20 /nobreak >nul
start cmd /k ".\bin\windows\kafka-server-start.bat .\config\server.properties 

I am not really sure what zookeeper does in this 'break' time but it helps. Try it and leave a comment if it helps.

-2

go to Kafka root directory and look for the logs file. and clear all logs. For instance: say your kafka is installed in the downloads folder:

cd ~/Downloads/kafka_2.13-2.6.0
rm -rf logs

It will resolve the issue.

Dhruv Choudhary
  • 143
  • 1
  • 2
  • 13