Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kafka topic is getting reappeared after 10 sec of deletion

I'm facing issue with kafka topic deletion.

Using kafka rest API's to create/delete topic and for producing & consuming messages. I have tried to delete the topic where the topic will be deleted, but after some time say 10 sec, topic gets reappeared.

Have checked the Consumer Group offsets and LAG is listed as negative.

docker run --net=host --rm confluentinc/cp-kafka:3.1.0 kafka-consumer-groups --zookeeper localhost:2181 --describe --group grp1

GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG OWNER

grp1 topic1 0 3 0 -3 none

like image 897
Pooja Avatar asked Oct 21 '25 04:10

Pooja


1 Answers

It seems deleting a kafka topic is still has some bugs.

* The only way to delete a topic permanently is as follows: *

  • stop the brokers

  • remove the directories on disk

sudo rm -rf kafka_data_dir/topic_name

  • remove the topic from zookeeper:

bin/zkCli.sh - to start zookeeper shell

rmr /config/topics/topic_name

rmr /brokers/topics/topic_name

rmr /admin/delete_topics/topic_name

like image 177
subzero Avatar answered Oct 23 '25 19:10

subzero



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!