简体   繁体   English

使用 kafka-consumer-groups.sh 脚本删除消费者组是删除消费者组元数据的安全方法吗?

[英]Is deleting a Consumer Group using kafka-consumer-groups.sh script a safe way to remove consumer group metadata?

I am using multithreaded kafka consumers for a single 60 partitions kafka topic, with each consumer thread mapped to each partiton.我将多线程 kafka 消费者用于单个 60 个分区的 kafka 主题,每个消费者线程都映射到每个分区。 After the consumption is complete, each consumer thread is closed using KafkaConsumer.close() method.消费完成后,使用KafkaConsumer.close()方法关闭每个消费者线程。

During reconsumption with same consumer groupid, (seek to beginning is used per consumer tread), 1 or 2 consumer threads fail to consume from their assigned partitions.在使用相同的消费者 groupid 重新消费期间,(每个消费者都使用寻找开始),1 或 2 个消费者线程无法从其分配的分区中消费。 If a new consumer group id is provided, this issue does not show up.如果提供了新的消费者组 ID,则不会出现此问题。

So, if the below script is used to delete a consumer group.因此,如果使用以下脚本删除消费者组。
bin/kafka-consumer-groups.sh --bootstrap-servers "3 Servers:port" --delete --group group1 bin/kafka-consumer-groups.sh --bootstrap-servers "3 服务器:端口" --delete --group group1

Is it a safe way to delete the consumer group metadata and if it also disconnects the active TCP connections from all consumers assigned to this group.删除消费者组元数据是否是一种安全的方法,如果它还断开与分配给该组的所有消费者的活动 TCP 连接。

Please share your opinions on this.请分享您对此的看法。

If you always seek to the beginning of the topic, you could instead disable auto commit and set auto offset reset to earliest.如果您总是寻找主题的开头,则可以禁用自动提交并将自动偏移重置设置为最早。 Then your app always starts consuming from the beginning然后你的应用总是从头开始消费

Otherwise, I personally would reset the group rather than delete it否则,我个人会重置组而不是删除它

https://kafka.apache.org/documentation/#basic_ops_consumer_group https://kafka.apache.org/documentation/#basic_ops_consumer_group

You can only reset and delete a group when there are no active consumers只有在没有活跃消费者时才能重置和删除组

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM