nico
nico

Reputation: 2121

Kafka bootstrap-servers vs zookeeper in kafka-console-consumer

I'm trying to test run a single Kafka node with 3 brokers & zookeeper. I wish to test using the console tools. I run the producer as such:

kafka-console-producer --broker-list localhost:9092,localhost:9093,localhost:9094 --topic testTopic

Then I run the consumer as such:

kafka-console-consumer --zookeeper localhost:2181 --topic testTopic --from-beginning

And I can enter messages in the producer and see them in the consumer, as expected. However, when I run the updated version of the consumer using bootstrap-server, I get nothing. E.g

kafka-console-consumer --bootstrap-server localhost:9092,localhost:9093,localhost:9094 --topic testTopic --from-beginning

This worked fine when I had one broker running on port 9092 so I'm thoroughly confused. Is there a way I can see what zookeeper is providing as the bootstrap server? Is the bootstrap server different from the broker list? Kafka compiled with Scala 2.11.

Upvotes: 16

Views: 51119

Answers (3)

Sean Glover
Sean Glover

Reputation: 1786

I experienced the same problem when using mismatched versions of:

  • Kafka client libraries
  • Kafka scripts
  • Kafka brokers

In my exact scenario I was using Confluent Kafka client libraries version 0.10.2.1 with Confluent Platform 3.3.0 w/ Kafka broker 0.11.0.0. When I downgraded my Confluent Platform to 3.3.2 which matched my client libraries the consumer worked as expected.

My theory is that the latest kafka-console-consumer using the new Consumer API was only retrieving messages using the latest format. There were a number of message format changes introduced in Kafka 0.11.0.0.

Upvotes: 0

nico
nico

Reputation: 2121

I have no idea what was wrong. Likely I put Kafka or Zookeeper in a weird state. After deleting the topics in the log.dir of each broker AND the zookeeper topics in /brokers/topics then recreating the topic, Kafka consumer behaved as expected.

Upvotes: 7

sam.ban
sam.ban

Reputation: 248

Bootstrap servers are same as kafka brokers. And if you want to see the list of bootstrap server zookeeper is providing, you can query ZNode information via any ZK client. All active brokers are registered under /brokers/ids/[brokerId]. All you need is zkQuorum address. Below command will give you list of active bootstrap servers :

./zookeeper-shell.sh localhost:2181 <<< "ls /brokers/ids"

Upvotes: 3

Related Questions