我有一个问题,我的一个消费群体中的许多Kafka客户端未正确关闭,因此Kafka集群认为它们仍处于连接状态。因此,我无法使用新版本的客户端连接到使用者组。它将停留在重新平衡步骤中。
根据文档,它们为should be removed after session.timeout.ms
或最大值为group.max.session.timeout.ms
。最初,我尝试将session.timeout.ms
设置为30000
毫秒(30秒),但未在Kafka启动时列出。当时group.max.session.timeout.ms
被设置为300000毫秒(5分钟)。使用者没有在30秒后删除。
之后,我尝试将group.max.session.timeout.ms
减少到30000毫秒(30秒),然后重新启动Kafka。但是,所有客户仍然只属于消费者组。
现在,大约2个小时后,客户仍然与消费者组保持联系。
我尝试通过以下方式delete the consumer group:
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--delete --group GroupName
这给了我
* Group 'GroupName' could not be deleted due to: NON_EMPTY_GROUP
不幸的是,似乎没有--force
标志。
接下来,我尝试使用此命令列出使用者组的所有成员:
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--members --group GroupName --describe
这给了我40至50个消费者组成员(他们都必须处于非活动状态,因为唯一活动的消费者已停止)。
有没有办法让Kafka从该组中清除所有消费者或强迫其删除整个消费者组?
答案 0 :(得分:0)
使用
表示使用者组仍在积极连接到服务器 您必须先终止该过程,然后再删除使用者组。这对我有用。
ps -ef | grep GroupName | grep -v grep | awk '{print $2}' | xargs kill
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--delete --group GroupName
答案 1 :(得分:0)
我不得不删除zookeeper和代理日志。
config/zookeeper.properties
config/server.properties
中)