kafka查看topic命令
./kafka-topics.sh --list --zookeeper master:2181
那如何删除topic?
1.修改server.properties
delete.topic.enable=true
2.重启kafka
直接kill -9 kafka进程id
启动kafka
nohup ./kafka-server-start.sh ../config/server.properties &
3.删除topic
./kafka-topics.sh --delete --zookeeper master:2181 --topic designTopic
再次查看topic,有可能被删除了,就不用下面的步骤了。
但大多数情况下,只是被标记删除了designTopic - marked for deletion,还是可以使用。
下面就删除这些被标记删除的topic
4.打开zookeeper客户端
#./zkCli.sh
5.zk查看被标记删除的topic
[zk: localhost:2181(CONNECTED) 0] ls /admin/delete_topics
[designTopic, designTopc]
zk列出所有topic
[zk: localhost:2181(CONNECTED) 1] ls /brokers/topics
[ambari_kafka_service_check, designTopic, designTopc, testTopic, test1, __consumer_offsets, testMyTopic]
6.zk删除topic
[zk: localhost:2181(CONNECTED) 5] rmr /brokers/topics/designTopic
[zk: localhost:2181(CONNECTED) 8] rmr /admin/delete_topics/designTopic
这下topic就彻底被删除了