gpt4 book ai didi

apache-kafka - 主题 "marked for deletion"何时/如何最终被删除?

转载 作者:行者123 更新时间:2023-12-03 05:29:21 25 4
gpt4 key购买 nike

我已发出删除主题的命令:

./bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic  vip_ips_alerts

它似乎给出了一个愉快的回应:

[2014-05-31 20:58:10,112] INFO zookeeper state changed (SyncConnected) (org.I0Itec.zkclient.ZkClient)
Topic "vip_ips_alerts" queued for deletion.

但现在 10 分钟后,该主题仍然出现在 --list 命令中:

./bin/kafka-topics.sh --zookeeper localhost:2181 --list
vip_ips_alerts - marked for deletion

那么这是什么意思呢?该主题什么时候会真正被删除?我如何加快这个过程?

最佳答案

tl;dr 在 Kafka 代理的 config/server.properties 中设置 delete.topic.enable = true 并...耐心等待.

最新开发版本的 Kafka 0.8.3-SNAPSHOT 会发生这种情况:

➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic my-topic --partitions 2 --replication-factor 1
Created topic "my-topic".

➜ kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic my-topic
Topic:my-topic PartitionCount:2 ReplicationFactor:1 Configs:
Topic: my-topic Partition: 0 Leader: 0 Replicas: 0 Isr: 0
Topic: my-topic Partition: 1 Leader: 0 Replicas: 0 Isr: 0

➜ kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic my-topic
Topic my-topic is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.

➜ kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-topics.sh --zookeeper localhost:2181 --list
➜ kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗

重点是在 config/server.properties 中添加 delete.topic.enable=true,用于启动 Kafka 代理。

➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ grep delete.topic.enable config/server.properties
delete.topic.enable=true

您还可以确保代理日志中的设置为 true:

➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-server-start.sh config/server.properties
[2015-07-24 22:33:26,184] INFO KafkaConfig values:
...
delete.topic.enable = true

关于apache-kafka - 主题 "marked for deletion"何时/如何最终被删除?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23976670/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com