Kafka consumer does not work with new API

I found something very strange with Kafka.

I have a producer with 3 brokers:

bin/kafka-console-producer.sh --broker-list localhost:9093, localhost:9094, localhost:9095 --topic topic

Then I try to start the user with a new API:

bin/kafka-console-consumer.sh --bootstrap-server localhost:9093,localhost:9094,localhost:9095 --topic topic --from-beginning

I have nothing! BUT if I use the old API:

bin/kafka-console-consumer.sh --zookeeper localhost:2181 --from-beginning --topic topic

I got my messages!

What's wrong with me?

PS: I am using Kafka 10

+1
source share
3 answers

I ended up solving my problem thanks to this thread: Kafka bootstrap-servers vs zookeeper in kafka-console-consumer

I believe this is a bug / incorrect configuration leading to a problem with zookeeper and kafka.

DECISION:

First, be sure to delete the topic of the section in the server.propertiesfiles of your brokers:

# Switch to enable topic deletion or not, default value is false
delete.topic.enable=true

Then delete the topic:

bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic myTopic

Delete all directories of /tmp/log.diryour brokers.

EDIT. , zookeeper /tmp/zookeeper/version-2/.

, /brokers/topics zookeeper, :

$ kafka/bin/zookeeper-shell.sh localhost:2181
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is disabled

rmr /broker/topics/mytopic

.

+2

. --partition API ( ..). CDH 5.12 + Kafka 0.11 ( ).

UPD:

, Kafka 0.11 ( 3.0.0 CDH parclel) . Kafka 0.10 . --partition .

0

, "", :

///

[2018-04-04 22:29:39,854] ERROR [KafkaApi-20] Number of alive brokers '1' does not meet the required replication factor '3' for the offsets topic (configured via 'offsets.topic.replication.factor'). This error can be ignored if the cluster is starting up and not all brokers are up yet. (kafka.server.KafkaApis) 

I just added the settings to my configuration file offsets.topic.replication.factor=1and restarted. He began to work normally.

0
source

Source: https://habr.com/ru/post/1667406/


All Articles