When/how does a topic “marked for deletion” get finally removed?

前端 未结 11 1009
天命终不由人
天命终不由人 2020-12-24 00:09

I have issued the command to delete a topic:

./bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic  vip_ips_alerts

It seemed to

相关标签:
11条回答
  • 2020-12-24 00:32

    My issue was something similar. I deleted a topic and it was giving me the same message when I was listing all the topics.

    I brought down the zookeeper and the broker. set the delete.topic.enable=true in my broker config file started zookeeper and the boker

    The topic was gone...thanks to Jacek Laskowski

    0 讨论(0)
  • 2020-12-24 00:33

    We had this issue when deleting topics. The topics had been created when delete.topic.enable=true had not been set. We set that in config, restarted kafka to apply the new config. Deleted the topics and saw the "marked for deletion". We then restarted kafka again. After 40 minutes though all topics had been deleted (9 topics with total partitions in the thousands). The topics with higher numbers of partitions seemed to take longer, which initially made it look like nothing was happening.

    0 讨论(0)
  • 2020-12-24 00:34

    You can do it.

    sudo ./zookeeper-shell.sh localhost:2181 rmr /brokers/topics/your_topic

    0 讨论(0)
  • 2020-12-24 00:34

    For kafka version 0.10.0.0 it is enough to enable the topic deletion by setting:

    delete.topic.enable
    

    The topic is deleted within few moments

    kafka-topics --delete --zookeeper your-zk:2181 --topic yourTopicName
    

    You can confirm that it is gone with the following command:

    kafka-topics --describe --zookeeper your-zk:2181 --topic yourTopicName
    
    0 讨论(0)
  • 2020-12-24 00:35

    tl;dr Set delete.topic.enable = true in config/server.properties of Kafka brokers and...be patient.

    It happens with the latest development version of Kafka 0.8.3-SNAPSHOT:

    ➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic my-topic --partitions 2 --replication-factor 1
    Created topic "my-topic".
    
    ➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic my-topic
    Topic:my-topic  PartitionCount:2    ReplicationFactor:1 Configs:
        Topic: my-topic Partition: 0    Leader: 0   Replicas: 0 Isr: 0
        Topic: my-topic Partition: 1    Leader: 0   Replicas: 0 Isr: 0
    
    ➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic my-topic
    Topic my-topic is marked for deletion.
    Note: This will have no impact if delete.topic.enable is not set to true.
    
    ➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-topics.sh --zookeeper localhost:2181 --list
    ➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗
    

    The point is to have delete.topic.enable=true in config/server.properties that you use to start a Kafka broker.

    ➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ grep delete.topic.enable config/server.properties
    delete.topic.enable=true
    

    You can also ensure the setting be true in a broker's log:

    ➜  kafka_2.11-0.8.3-SNAPSHOT git:(trunk) ✗ ./bin/kafka-server-start.sh config/server.properties
    [2015-07-24 22:33:26,184] INFO KafkaConfig values:
            ...
            delete.topic.enable = true
    
    0 讨论(0)
  • 2020-12-24 00:35

    I faced the same issue and spend a couple of days trying to identify with the issue was. I triggered command to delete the topics, however the topics were marked for deletion but they were not deleted.

    1. I first checked the configuration which are set right. Under: server.properties

      delete.topic.enable=true for all brokers

    2. I restarted the broker to check if the topics got delete (No!!).
    3. I check no data under /kafka/data folder.
    4. I even considered the option to wait until the retention time got exceed.

    None helped. I had to finally login to zooker

    ./zkCli.sh # and delete the topics using 
    rmr /brokers/topics/<<topic>> and rmr /admin/delete_topics/<<topic>>
    

    Please remember to restart kafka after this. Hope this solves your issue.

    0 讨论(0)
提交回复
热议问题