Bird
0
0

How can you programmatically trigger a rebalance in a Kafka consumer group to test partition assignment changes?

hard📝 Application Q9 of 15
Kafka - Consumer Groups

How can you programmatically trigger a rebalance in a Kafka consumer group to test partition assignment changes?

ABy restarting the Kafka broker
BBy adding or removing a consumer from the group
CBy changing the topic's replication factor
DBy producing more messages to the topic
Step-by-Step Solution
Solution:
  1. Step 1: Identify actions causing rebalance

    Adding or removing consumers triggers group membership change, causing rebalance.
  2. Step 2: Eliminate other options

    Restarting broker or changing replication factor does not trigger consumer group rebalance; producing messages affects data but not assignment.
  3. Final Answer:

    By adding or removing a consumer from the group -> Option B
  4. Quick Check:

    Trigger rebalance = change consumer group membership [OK]
Quick Trick: Change consumer count to trigger rebalance [OK]
Common Mistakes:
  • Restarting broker triggers rebalance
  • Changing replication factor triggers rebalance
  • Producing messages triggers rebalance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes