Zookeeper & Kafka error KeeperErrorCode=NodeExists

WindowsApache KafkaApache Zookeeper

Windows Problem Overview


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)

Windows Solutions


Solution 1 - Windows

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.

Solution 2 - Windows

According to Confluent at https://groups.google.com/forum/#!topic/confluent-platform/h0gEik_Ii1E on 2016/10/08

> Those are not errors, you can see the log level is INFO. It is simply logging that Kafka tried to create a node that already exists. Totally normal behavior for Kafka and nothing to worry about.

Is there an actual problem related to the message or is everything working correctly?

Solution 3 - Windows

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.

Solution 4 - Windows

I had this error in my Kafka running on Windows 7. I think this exception is not a problem since it's only info level. Just make sure the broker is still running. Even with this error, I could still:

  1. Create and list a topic kafka-topics.bat.
  2. Consume a topic kafka-console-consumer.bat.
  3. Programmatically send a message producer.send(new ProducerRecord<String, String>("topic", "hello")).get().

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionadellaroccaView Question on Stackoverflow
Solution 1 - WindowsAlok MishraView Answer on Stackoverflow
Solution 2 - WindowsdisrvptorView Answer on Stackoverflow
Solution 3 - WindowsDhruv ChoudharyView Answer on Stackoverflow
Solution 4 - WindowsjpllosaView Answer on Stackoverflow