问题描述
我尝试使用以下命令删除现有主题(我使用 kafka 管理控制台检查过);
I try to delete a existing topic (I checked using kafka management console) using following command;
#./kafka-topics.sh --zookeeper zookeeper.xx.com:2181/chroot --delete --topic testTopic
但它说zookeeper中没有主题.[1]
But it says topic not available in zookeeper.[1]
我在运行时创建这些主题.(我使用Highlevel Client APIs.我认为它是在kafka集群中创建的?)
I create those topics at runtime . (I use Highlevel Client APIs.I think it is created in kafka clusters? )
如何使用这个 bash 脚本删除主题?
How can I delete the topic using this bash script?
[1]
Error while executing topic command : Topic targettopic does not exist on ZK path zookeeper.xx.com:2181/chroot
[2016-10-14 11:58:59,919] ERROR java.lang.IllegalArgumentException: Topic streamtargettopic does not exist on ZK path zookeeper.xx.com:2181/chroot
at kafka.admin.TopicCommand$.deleteTopic(TopicCommand.scala:169)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:69)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
推荐答案
您可以使用以下命令查看 Zookeeper
中可用的主题列表
.
You can use below command to check the list of topics
available in Zookeeper
.
bin/kafka-topics.sh --list --zookeeper localhost:2181
同时在 server.properties
delete.topic.enable=true
然后尝试使用
bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic test
这篇关于kafka-topics.sh ---delete --topic ''testTopic'' 不适用于 kafka V 0.10.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!