[Series] ddocker docker container, completely remove Kafka in topic

ddocker container, completely remove Kafka in topic

1, into the container

docker exec -it 46fb57e04491 /bin/sh

2, delete kafka storage directory (server.properties log.dirs configuration file, the default is "/ kafka / kafka-logs") related topic directory

3, Kafka delete the topic of command is

cd  /opt/kafka_2.12-2.4.0/bin
./kafka-topics  --delete --zookeeper 【zookeeper server】  --topic 【topic name】

     If kafaka boot loader configuration file when server.properties not configured delete.topic.enable = true, then the time of deletion are not really deleted, but the topic is marked as: marked for deletion

     You can order: to view all topic

./kafka-topics --zookeeper 【zookeeper server】 --list 

     At this point you really wants to remove it, you can do the following:

     (1) Log zookeeper client: Command:

./bin/zookeeper-shell.sh --zookeeper 【zookeeper server】

     (2) Locate the directory where the topic:

ls /brokers/topics

     (3) to find the topic you want to delete, execute the command: you can, then topic deleted.

rmr /brokers/topics/【topic name】

       (4) Also marked for deletion are marked as the topic you can get by command zookeeper client:

ls /admin/delete_topics/【topic name】

    If you delete a topic here, then marked for deletion mark disappears

    zookeeper's config also has information about the topic of: ls / config / topics / topic name [] I did not know what use

 

to sum up:

Completely remove topic:

 1, delete kafka storage directory (server.properties log.dirs configuration file, the default is "/ tmp / kafka-logs") related topic directory

 2, if you configure delete.topic.enable = true directly through the command to delete, if the command can not delete, delete directly through the zookeeper-client off topic to the next broker.

发布了111 篇原创文章 · 获赞 28 · 访问量 4万+

Guess you like

Origin blog.csdn.net/weixin_42697074/article/details/103814670