清除Kafka主题 [英] Purge Kafka Topic
本文介绍了清除Kafka主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在kafka中清除该主题?
我在本地计算机上将太大的消息推送到kafka消息主题中,现在出现错误:
I pushed a message that was too big into a kafka message topic on my local machine, now I'm getting an error:
kafka.common.InvalidMessageSizeException: invalid message size
在这里增加fetch.size
并不理想,因为我实际上并不希望接受那么大的消息.
Increasing the fetch.size
is not ideal here, because I don't actually want to accept messages that big.
推荐答案
暂时将主题的保留时间更新为一秒:
Temporarily update the retention time on the topic to one second:
kafka-topics.sh --zookeeper <zkhost>:2181 --alter --topic <topic name> --config retention.ms=1000
在较新的Kafka版本中,您也可以使用kafka-configs --entity-type topics
And in newer Kafka releases, you can also do it with kafka-configs --entity-type topics
kafka-configs.sh --zookeeper <zkhost>:2181 --entity-type topics --alter --entity-name <topic name> --add-config retention.ms=1000
然后等待清除生效(大约一分钟).清除后,恢复先前的retention.ms
值.
then wait for the purge to take effect (about one minute). Once purged, restore the previous retention.ms
value.
这篇关于清除Kafka主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文