首先关闭当前topic的生产者与消费者,确保topic不再被使用,否则据说会有bug
进入kafka的目录:
cd ~/software/kafka_2.12-2.7.1/bin
查看当前的全部topic:
./kafka-topics.sh --list --zookeeper localhost:2181
删除这个topic:
./kafka-topics.sh --zookeeper localhost:2181 --delete --topic topic的名称
如果出现报错:Topic xxxx is marked for deletion.Note: This will have no impact if delete.topic.enable is not set to true.
则需要修改server.properties
文件:
cd ../config/
vim server.properties
然后写入:
delete.topic.enable=true