如何永久删除kafka主题?

时间:2016-06-28 18:26:52

标签: apache-kafka

您好运行此命令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日志目录时,主题被删除,但几分钟后它再次出现。

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

 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)

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

由于

1 个答案:

答案 0 :(得分:2)

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

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