1. Delete the kafka storage directory (server.properties file log.dirs configuration, the default is "/tmp/kafka-logs") related topic directory
2. The command for Kafka to delete a topic is:
kafka/bin/kafka-topics.sh --delete --zookeeper Zookeeper地址 --topic 主题名称
If "delete.topic.enable=true" is not configured in server.properties in the configuration file loaded when kafaka starts, then the deletion at this time is not a real deletion, but marks the topic for deletion: marked for deletion
- You can view all topics with the following command:
kafka/bin/kafka-topics.sh --list --zookeeper Zookeeper地址
- At this point, if you want to actually delete it, you can do the following:
(1) The command to log in to the zookeeper client:
zookeeper/bin/zkCli.sh
(2) Find the directory where the topic is located:
ls /brokers/topics
(3) Find the topic to be deleted and execute the following command. At this time, the topic is completely deleted:
rmr /brokers/topics/topic名称
In addition, the topic marked as marked for deletion can be obtained by the command in the zookeeper client: ls /admin/delete_topics/topic name, if you delete the topic here, then the marked for deletion mark disappears.
Zookeeper's config is also related Topic information, I don't know what it is for now:
ls /config/topics/topic nameSummary :
Delete topic completely:
1. Delete the kafka storage directory (server.properties file log.dirs configuration, default is "/tmp/kafka-logs") related topic directory
2. If delete.topic.enable=true is configured, directly pass Command to delete, if the command cannot be deleted, you can delete the topic under the broker directly through the zookeeper client.