Hi Akhilesh, Why would this approach need to be taken over the kafka-topics tool, out of interest?
Thanks Adrian -----Original Message----- From: Akhilesh Pathodia [mailto:pathodia.akhil...@gmail.com] Sent: 07 April 2017 09:37 To: users@kafka.apache.org Subject: Re: Topic deletion Hi Adrian, You will have to delete the broker directory from zookeeper. This can be done from zookeeper cli. Connect to zookeeper cli using below command: zookeeper-client -server <ZOOKEEPER_URI> Then run below command : rmr /brokers/topics/<TOPIC_NAME> Thanks, AKhilesh On Thu, Apr 6, 2017 at 11:03 PM, Adrian McCague <adrian.mcca...@zopa.com> wrote: > Hi all, > > I am trying to understand topic deletion in kafka, there appears to be > very little documentation or answers on how this works. Typically they > just say to turn on the feature on the broker (in my case it is). > > I executed: > Kafka-topics.bat -delete -zookeeper keeperhere -topic mytopic > > Running this again yields: > Topic mytopic is already marked for deletion. > > --describe yields: > Topic: mytopic PartitionCount:6 ReplicationFactor:3 Configs: > retention.ms=0 > Topic: mytopic Partition: 0 Leader: -1 Replicas: > 1006,1001,1005 Isr: > Topic mytopic Partition: 1 Leader: -1 Replicas: > 1001,1005,1003 Isr: > Topic: mytopic Partition: 2 Leader: -1 Replicas: > 1005,1003,1004 Isr: > Topic: mytopic Partition: 3 Leader: -1 Replicas: > 1003,1004,1007 Isr: > Topic: mytopic Partition: 4 Leader: -1 Replicas: > 1004,1007,1006 Isr: > Topic: mytopic Partition: 5 Leader: -1 Replicas: > 1007,1006,1001 Isr: > > You can see that the deletion mark has meant that the Leader is -1. > Also I read somewhere that retention needs to be set to something low > to trigger the deletion, hence the config of retention.ms=0 > > Consumers (or streams in my case) no longer see the topic: > org.apache.kafka.streams.errors.TopologyBuilderException: Invalid > topology building: stream-thread [StreamThread-1] Topic not found: > mytopic > > And I can't create a new topic in its place: > [2017-04-06 18:26:00,702] ERROR > org.apache.kafka.common.errors.TopicExistsException: > Topic 'mytopic' already exists. (kafka.admin.TopicCommand$) > > I am a little lost as to where to go next, could someone explain how > topic deletion is actually applied when a topic is 'marked' for > deletion as that may help trigger it. > > Thanks! > Adrian > >