如何永久删除kafka主题

如何永久删除kafka主题

本文介绍了如何永久删除kafka主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,运行这个命令 kafka-topics --zookeeper localhost --delete --topic MyTopic

Hi running this command kafka-topics --zookeeper localhost --delete --topic MyTopic

这有效.

[2016-06-28 14:22:43,533] INFO Deleting index /data1/kafka/MyTopic-XX/00000000000000000000.index (kafka.log.OffsetIndex)
[2016-06-28 14:22:43,533] INFO Deleted log for partition [MyTopic,xx] in /data1/kafka/MyTopic-xx. (kafka.log.LogManager)

其中 XX 是分区.当我查看 kafka 日志目录时,该主题已被删除,但几分钟后它又重新出现.

Where XX is the partition. When I go look at the kafka log dir the topic is deleted, but then after a few minutes it reappears.

当我查看 kafka 日志时,我看到...

When I look at kafka logs I see...

 INFO Created log for partition [MyTopic,XX] in /data1/kafka with properties {compression.type -> producer, message.format.version -> 0.10.0-IV1, file.delete.delay.ms -> 60000, max.message.bytes -> 1000012, message.timestamp.type -> CreateTime, min.insync.replicas -> 1, segment.jitter.ms -> 0, preallocate -> false, min.cleanable.dirty.ratio -> 0.5, index.interval.bytes -> 4096, unclean.leader.election.enable -> true, retention.bytes -> -1, delete.retention.ms -> 86400000, cleanup.policy -> delete, flush.ms -> 9223372036854775807, segment.ms -> 604800000, segment.bytes -> 1073741824, retention.ms -> 604800000, message.timestamp.difference.max.ms -> 9223372036854775807, segment.index.bytes -> 10485760, flush.messages -> 9223372036854775807}. (kafka.log.LogManager)
[2016-06-28 13:59:39,623] INFO Partition [MyTopic,XX] on broker 0: No checkpointed highwatermark is found for partition [MyTopic,XX] (kafka.cluster.Partition)

所以它似乎以某种方式重新创建它?

So it seems to be re-creating it somehow?

谢谢

推荐答案

禁用代理中的 auto.create.topics.enable 属性.

Disable auto.create.topics.enable property in the broker.

注意:默认情况下启用此属性.生产者/消费者对不存在的主题的请求会自动创建.如果要禁用它,请确保在启动客户端应用程序之前创建所需的主题.

CAUTION: This property is enabled by default. Requests from a producer / consumer to a topic which don't exists gets created automatically. If you going to disable it, make sure that you're creating the required topics before starting your client applications.

这篇关于如何永久删除kafka主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 12:47