'How to check that Kafka does rebalance?

I'm writing a Go service that works with Kafka. I have a problems with bad commits when broker rebalances. I want to do an experiment forcing Kafka to rebalance and to see how the service behaves.

What I do:

  • running Kafka in Docker locally (broker, zookeeper, schema registry and control center)
  • created a topic with 2 partition
  • running producer that sends messages to both partitions

Then I'm running two consumers with the same groupID, after that I'm closing one. It seems to me that broker should start rebalancing this moment. Or no? Who's logs should I check for it?



Solution 1:[1]

You can check that by running the following commands:

bin/kafka-consumer-groups --bootstrap-server host:9092 --list

and to describe:

bin/kafka-consumer-groups --bootstrap-server host:9092 --describe --group foo

Full documentation could be found here: Kafka consumer group

Solution 2:[2]

Who's logs should I check for it?

The running consumer's log should be checked, depending on if the library you're using actually logs such information.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dnej
Solution 2 OneCricketeer