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

前端 未结 11 1019
天命终不由人
天命终不由人 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条回答
  •  萌比男神i
    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
    

提交回复
热议问题