问题
I want to give some time to my consumer to restart so that unnecessary rebalance doesnt happen. How can I do that? In case of shutdown, I want replication to come in picture and after some time if consumer is not back up, rebalance should occur else not.
回答1:
There's broker level config called group.initial.rebalance.delay.ms
you can tweak.
The amount of time the group coordinator will wait for more consumers to join a new group before performing the first rebalance. A longer delay means potentially fewer rebalances, but increases the time until processing begins.
https://kafka.apache.org/documentation/
来源:https://stackoverflow.com/questions/56561378/how-to-introduce-delay-in-rebalancing-in-case-of-kafka-consumer-group