当一个topic写入到kafka,而我们接入了多了个消费组,这种情况下,其中某个消费组停止消费,却会看到对应消费组的消息堆积依然在叠加,这是个奇怪的问题,暂时不知道什么原因,不过可以通过如下方式,将这个消费组删除,如果这些消息内容不是很重要的话。

此时来到kafka集群,进行一波查看:

cd /usr/local/kafka/bin

查看对应消费组:

./kafka-consumer-groups.sh --bootstrap-server 10.3.9.105:9092 --list|grep vector

查看该消费组详情:

./kafka-consumer-groups.sh --bootstrap-server 10.3.9.105:9092 --describe --group vector-group

Consumer group 'vector-group' has no active members.

TOPIC             PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID     HOST            CLIENT-ID
nginx_access-json 6          20860823645     20863941258     3117613         -               -               -
nginx_access-json 32         7079366043      7082484017      3117974         -               -               -
nginx_access-json 19         18831750772     18834869297     3118525         -               -               -
nginx_access-json 25         7079254321      7082372335      3118014         -               -               -
nginx_access-json 16         18831738315     18834855686     3117371         -               -               -
nginx_access-json 5          26853103894     26856224627     3120733         -               -               -
nginx_access-json 26         7079407716      7082528677      3120961         -               -               -
nginx_access-json 10         20860709161     20863824916     3115755         -               -               -
nginx_access-json 2          26853198869     26856314382     3115513         -               -               -
nginx_access-json 9          20860734059     20863849934     3115875         -               -               -
nginx_access-json 20         7079285753      7082406080      3120327         -               -               -
nginx_access-json 17         18831568395     18834686220     3117825         -               -               -
nginx_access-json 11         20860468934     20863586315     3117381         -               -               -
nginx_access-json 3          26853057203     26856172911     3115708         -               -               -
nginx_access-json 33         7079427219      7082542547      3115328         -               -               -
nginx_access-json 24         7079333972      7082449832      3115860         -               -               -
nginx_access-json 31         7079275520      7082390038      3114518         -               -               -
nginx_access-json 23         7079305622      7082421647      3116025         -               -               -
nginx_access-json 30         7079513281      7082630851      3117570         -               -               -
nginx_access-json 27         7079328833      7082447027      3118194         -               -               -
nginx_access-json 4          26852831434     26855949848     3118414         -               -               -
nginx_access-json 12         18831619833     18834735405     3115572         -               -               -
nginx_access-json 13         18831782140     18834896831     3114691         -               -               -
nginx_access-json 18         18831578690     18834692791     3114101         -               -               -
nginx_access-json 34         7079300839      7082416771      3115932         -               -               -

删除之:

./kafka-consumer-groups.sh --bootstrap-server 10.3.9.105:9092 --delete --group vector-group

然后再看堆积的监控,就没有新的消息往里边注入了。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐