Confusion about Kafka topic removal

I am using Kafka 0.8.0, this is the version of Cloudera. When I deleted the topic, for example: kafka-topics --zookeeper 10.0.0.11:2181/ --delete --topic test this is the answer:

Topic test is already marked for deletion.

But then I recreated it, he selected the exception as follows:

kafka-topics --create --zookeeper 10.0.0.11:2181 --partitions 90 --replication-factor 2 --topic test

Error while executing topic command Topic "test" already exists.
kafka.common.TopicExistsException: Topic "test" already exists.

Any ideas please? How to delete a topic and its data.

+4
source share
5 answers

My version of Kakfa is kafka_2.10-0.8.2.2, the link below works for me (from Delete topic in Kafka 0.8.1.1 )

Add the line below to ${kafka_home}/config/server.properties

delete.topic.enable=true   

Restart the kafka server with the new configuration:

${kafka_home}/bin/kafka-server-start.sh ~/kafka/config/server.properties

Delete the topics you want:

${kafka_home}/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic daemon12

Additional Information from Kafka Questions :

0.8.2.x. ( delete.topic.enable to true) .

+5
  • , kafka config.poperties delete.topic.enable .
  • bin/kafka-topics.sh --delete --zookeeper localhost: 2181 --topic test

, .

  1. zookeeper :

    . stop zookeeper

    . rmr/broker/themes

    . ,

    /bin/kafka-topics.sh --zookeeper maxiq: 2181 --list

+5

delete.topic.enable false , --delete ( ).

Topic test is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.

, , @Shawn

+2

delete.topic.enable=true server.property.

Because if kafka restart with ambari, it again will overwrite the file delete.topic.enable =false.

Only in ambari, click kafak/config/advance kafka broker/delete.topic.enable =true, it will work.

I just found it as of now.

0
source

Delete a topic in kafka Step 1 →> cd / usr / lib / zookeeper / bin

step 2 →> zkCli.sh -server 127.0.0.1:2181

Step 3 →> rmr / brokers / themes / topic_name

0
source

Source: https://habr.com/ru/post/1625591/


All Articles