Apache Kafka consumer consumes messages with “partition” option, but not with “group” option

I am running a plain Apache Kafka server (version 3.4.1) which I would like to connect to a Telegraf consumer. The Telegraf [[inputs.kafka_consumer]] plugin has the option to consume by Kafka “group”. When staring Telegraf, I get an error message

[inputs.kafka_consumer] Error in plugin: consume: kafka server: Request was for a consumer group that is not coordinated by this broker

Hence, I started to investigate my setup by using the Kafka console tools and found that when executing

 ./kafka-console-consumer.sh --bootstrap-server myserver:9092 --topic test --partition 0

and sending messages via kafka-console-consumer.sh, these messages pop up in the console “consumer” window as expected.

In contrast to this, when I run

 ./kafka-console-consumer.sh --bootstrap-server myserver:9092 --topic test --group my-group

nothing happens in the “consumer” window. Furthermore, the command

./kafka-consumer-groups.sh --bootstrap-server myserver:9092 --list

yields nothing.

What do I have to do to cause the consumer with the “group” option to “see” the messages produced to the topic “test”? Ultimately, how can I solve the Telegraf error?

Read more here: Source link