如何从特定主题中删除Kafka消费者组? [英] How to remove a Kafka consumer group from a specific topic?

查看:711
本文介绍了如何从特定主题中删除Kafka消费者组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更改了Web服务的消费者组ID,以收听Kafka主题.现在,旧的组ID仍已注册到该主题,但是没有使用该组ID的使用者.因此,它是滞后的.如何从特定主题中移除特定的消费群体?

I changed the consumer-group-id of my web service listening to a Kafka topic. Now, the old group id is still registered to the topic, but there is no consumer with that group id. Therefore, it is lagging. How can I remove a specific consumer group from a specific topic?

我尝试过:

kafka-consumer-groups --bootstrap-server kafka01.myserver.com:9092 --topic通知主题--delete --group old-consumer-group --execute

但是它返回:"使用者不支持从使用者组中删除特定于主题的偏移量."

我应该完全删除该消费群体吗?我使用相同的组ID收听其他主题,它们会受到影响吗?

Should I remove the consumer group totally? I use the same group id listening to other topics, are they going to be affected?

推荐答案

从Kafka 2.4.0开始,可以从主题中删除单个消费者组ID偏移量.

Starting with Kafka 2.4.0 it is possible to delete individual consumer group id offsets from a topic.

该呼叫非常接近您已尝试的呼叫,但是需要-delete-offsets 而不是-delete :

The call is very close to what you have already tried, but requires --delete-offsets instead of --delete:

./kafka-consumer-groups.sh \
  --bootstrap-server <bootstrap-server-url> \
  --delete-offsets \
  --group <my-group> \
  --topic <topic-name>

到目前为止,这尚未反映在官方文档(Kafka 2.7.0及以下).但是,它在改进建议的融合文档

To date this is not reflected in the official documentation (Kafka 2.7.0 and below). However, it is described in a confluence document of improvement proposal KIP-496 that has been implemented and released.

这篇关于如何从特定主题中删除Kafka消费者组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆