You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Ratha v <vi...@gmail.com> on 2016/10/12 04:18:19 UTC

How can I delete a topic programatically?

Hi all;

I have two topics(source and target). I do some processing on the message
available in the source topic and i merge both topic.
That is;

builder.stream(sourceTopic).to(targetTopic)

Once merged I no longer require the sourceTopic. I want to delete it.

How can I do that programatically in java? I use highelevel  client APIs,
kafka v 0.10.0.1


Thanks
-- 
-Ratha
http://vvratha.blogspot.com/

Re: How can I delete a topic programatically?

Posted by Ratha v <vi...@gmail.com>.
Thanks kaufman..Yes That was the issue . Now I can delete.

On 15 October 2016 at 00:50, Kaufman Ng <ka...@confluent.io> wrote:

> The "chroot" is in ZK path is really a placeholder.  It's not a real path
> in ZK.
>
> Try the default ZK path: zookeeper.xx.com:2181/
>
>
> On Thu, Oct 13, 2016 at 9:06 PM, Ratha v <vi...@gmail.com> wrote:
>
> > Hi Jianbin;
> > I tried like this; Where I provided my zookeeper host. But it says[1] . I
> > use kafka 0.10. And I see my topic available using KafkaManagementTool.
> >
> > How can I overcome this issue?
> >
> > [1]Error while executing topic command : Topic targettopic does not exist
> > on ZK path zookeeper.xx.com:2181/chroot
> >
> > *[2016-10-14 11:58:59,919] ERROR java.lang.IllegalArgumentException:
> Topic
> > streamtargettopic does not exist on ZK path zookeeper.xx.com:2181/chroot
> > <http://zookeeper.xx.com:2181/chroot>*
> >
> > * at kafka.admin.TopicCommand$.deleteTopic(TopicCommand.scala:169)*
> >
> > * at kafka.admin.TopicCommand$.main(TopicCommand.scala:69)*
> >
> > * at kafka.admin.TopicCommand.main(TopicCommand.scala)*
> >
> >  bin/kafka-topics.sh --zookeeper zk_host:port/chroot --delete --topic
> > my_topic_name
> >
> >
> > On 12 October 2016 at 17:02, Ratha v <vi...@gmail.com> wrote:
> >
> > > Thank you..
> > >
> > > On 12 October 2016 at 16:30, Jianbin Wei <ji...@netskope.com>
> > wrote:
> > >
> > >> You can check this
> > >>
> > >> http://kafka.apache.org/documentation.html#basic_ops_add_topic
> > >>
> > >> But from our experience it is best to delete topics one by one, i.e.,
> > >> make sure Kafka is in good shape before and after deleting a topic
> > before
> > >> working on next one.
> > >>
> > >> Regards,
> > >>
> > >> -- Jianbin
> > >>
> > >> > On Oct 11, 2016, at 9:26 PM, Ratha v <vi...@gmail.com> wrote:
> > >> >
> > >> > Thanks..Which bash script I need to run?
> > >> >
> > >> >> On 12 October 2016 at 15:20, Ali Akhtar <al...@gmail.com>
> > wrote:
> > >> >>
> > >> >> The last time I tried, I couldn't find a way to do it, other than
> to
> > >> >> trigger the bash script for topic deletion programatically.
> > >> >>
> > >> >>> On Wed, Oct 12, 2016 at 9:18 AM, Ratha v <vi...@gmail.com>
> > >> wrote:
> > >> >>>
> > >> >>> Hi all;
> > >> >>>
> > >> >>> I have two topics(source and target). I do some processing on the
> > >> message
> > >> >>> available in the source topic and i merge both topic.
> > >> >>> That is;
> > >> >>>
> > >> >>> builder.stream(sourceTopic).to(targetTopic)
> > >> >>>
> > >> >>> Once merged I no longer require the sourceTopic. I want to delete
> > it.
> > >> >>>
> > >> >>> How can I do that programatically in java? I use highelevel
> client
> > >> APIs,
> > >> >>> kafka v 0.10.0.1
> > >> >>>
> > >> >>>
> > >> >>> Thanks
> > >> >>> --
> > >> >>> -Ratha
> > >> >>> http://vvratha.blogspot.com/
> > >> >>>
> > >> >>
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > -Ratha
> > >> > http://vvratha.blogspot.com/
> > >>
> > >
> > >
> > >
> > > --
> > > -Ratha
> > > http://vvratha.blogspot.com/
> > >
> >
> >
> >
> > --
> > -Ratha
> > http://vvratha.blogspot.com/
> >
>
>
>
> --
> Kaufman Ng
> Solutions Architect | Confluent
> +1 646 961 8063 | @kaufmanng
> www.confluent.io
>



-- 
-Ratha
http://vvratha.blogspot.com/

Re: How can I delete a topic programatically?

Posted by Kaufman Ng <ka...@confluent.io>.
The "chroot" is in ZK path is really a placeholder.  It's not a real path
in ZK.

Try the default ZK path: zookeeper.xx.com:2181/


On Thu, Oct 13, 2016 at 9:06 PM, Ratha v <vi...@gmail.com> wrote:

> Hi Jianbin;
> I tried like this; Where I provided my zookeeper host. But it says[1] . I
> use kafka 0.10. And I see my topic available using KafkaManagementTool.
>
> How can I overcome this issue?
>
> [1]Error while executing topic command : Topic targettopic does not exist
> on ZK path zookeeper.xx.com:2181/chroot
>
> *[2016-10-14 11:58:59,919] ERROR java.lang.IllegalArgumentException: Topic
> streamtargettopic does not exist on ZK path zookeeper.xx.com:2181/chroot
> <http://zookeeper.xx.com:2181/chroot>*
>
> * at kafka.admin.TopicCommand$.deleteTopic(TopicCommand.scala:169)*
>
> * at kafka.admin.TopicCommand$.main(TopicCommand.scala:69)*
>
> * at kafka.admin.TopicCommand.main(TopicCommand.scala)*
>
>  bin/kafka-topics.sh --zookeeper zk_host:port/chroot --delete --topic
> my_topic_name
>
>
> On 12 October 2016 at 17:02, Ratha v <vi...@gmail.com> wrote:
>
> > Thank you..
> >
> > On 12 October 2016 at 16:30, Jianbin Wei <ji...@netskope.com>
> wrote:
> >
> >> You can check this
> >>
> >> http://kafka.apache.org/documentation.html#basic_ops_add_topic
> >>
> >> But from our experience it is best to delete topics one by one, i.e.,
> >> make sure Kafka is in good shape before and after deleting a topic
> before
> >> working on next one.
> >>
> >> Regards,
> >>
> >> -- Jianbin
> >>
> >> > On Oct 11, 2016, at 9:26 PM, Ratha v <vi...@gmail.com> wrote:
> >> >
> >> > Thanks..Which bash script I need to run?
> >> >
> >> >> On 12 October 2016 at 15:20, Ali Akhtar <al...@gmail.com>
> wrote:
> >> >>
> >> >> The last time I tried, I couldn't find a way to do it, other than to
> >> >> trigger the bash script for topic deletion programatically.
> >> >>
> >> >>> On Wed, Oct 12, 2016 at 9:18 AM, Ratha v <vi...@gmail.com>
> >> wrote:
> >> >>>
> >> >>> Hi all;
> >> >>>
> >> >>> I have two topics(source and target). I do some processing on the
> >> message
> >> >>> available in the source topic and i merge both topic.
> >> >>> That is;
> >> >>>
> >> >>> builder.stream(sourceTopic).to(targetTopic)
> >> >>>
> >> >>> Once merged I no longer require the sourceTopic. I want to delete
> it.
> >> >>>
> >> >>> How can I do that programatically in java? I use highelevel  client
> >> APIs,
> >> >>> kafka v 0.10.0.1
> >> >>>
> >> >>>
> >> >>> Thanks
> >> >>> --
> >> >>> -Ratha
> >> >>> http://vvratha.blogspot.com/
> >> >>>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > -Ratha
> >> > http://vvratha.blogspot.com/
> >>
> >
> >
> >
> > --
> > -Ratha
> > http://vvratha.blogspot.com/
> >
>
>
>
> --
> -Ratha
> http://vvratha.blogspot.com/
>



-- 
Kaufman Ng
Solutions Architect | Confluent
+1 646 961 8063 | @kaufmanng
www.confluent.io

Re: How can I delete a topic programatically?

Posted by Ratha v <vi...@gmail.com>.
Hi Jianbin;
I tried like this; Where I provided my zookeeper host. But it says[1] . I
use kafka 0.10. And I see my topic available using KafkaManagementTool.

How can I overcome this issue?

[1]Error while executing topic command : Topic targettopic does not exist
on ZK path zookeeper.xx.com:2181/chroot

*[2016-10-14 11:58:59,919] ERROR java.lang.IllegalArgumentException: Topic
streamtargettopic does not exist on ZK path zookeeper.xx.com:2181/chroot
<http://zookeeper.xx.com:2181/chroot>*

* at kafka.admin.TopicCommand$.deleteTopic(TopicCommand.scala:169)*

* at kafka.admin.TopicCommand$.main(TopicCommand.scala:69)*

* at kafka.admin.TopicCommand.main(TopicCommand.scala)*

 bin/kafka-topics.sh --zookeeper zk_host:port/chroot --delete --topic
my_topic_name


On 12 October 2016 at 17:02, Ratha v <vi...@gmail.com> wrote:

> Thank you..
>
> On 12 October 2016 at 16:30, Jianbin Wei <ji...@netskope.com> wrote:
>
>> You can check this
>>
>> http://kafka.apache.org/documentation.html#basic_ops_add_topic
>>
>> But from our experience it is best to delete topics one by one, i.e.,
>> make sure Kafka is in good shape before and after deleting a topic before
>> working on next one.
>>
>> Regards,
>>
>> -- Jianbin
>>
>> > On Oct 11, 2016, at 9:26 PM, Ratha v <vi...@gmail.com> wrote:
>> >
>> > Thanks..Which bash script I need to run?
>> >
>> >> On 12 October 2016 at 15:20, Ali Akhtar <al...@gmail.com> wrote:
>> >>
>> >> The last time I tried, I couldn't find a way to do it, other than to
>> >> trigger the bash script for topic deletion programatically.
>> >>
>> >>> On Wed, Oct 12, 2016 at 9:18 AM, Ratha v <vi...@gmail.com>
>> wrote:
>> >>>
>> >>> Hi all;
>> >>>
>> >>> I have two topics(source and target). I do some processing on the
>> message
>> >>> available in the source topic and i merge both topic.
>> >>> That is;
>> >>>
>> >>> builder.stream(sourceTopic).to(targetTopic)
>> >>>
>> >>> Once merged I no longer require the sourceTopic. I want to delete it.
>> >>>
>> >>> How can I do that programatically in java? I use highelevel  client
>> APIs,
>> >>> kafka v 0.10.0.1
>> >>>
>> >>>
>> >>> Thanks
>> >>> --
>> >>> -Ratha
>> >>> http://vvratha.blogspot.com/
>> >>>
>> >>
>> >
>> >
>> >
>> > --
>> > -Ratha
>> > http://vvratha.blogspot.com/
>>
>
>
>
> --
> -Ratha
> http://vvratha.blogspot.com/
>



-- 
-Ratha
http://vvratha.blogspot.com/

Re: How can I delete a topic programatically?

Posted by Ratha v <vi...@gmail.com>.
Thank you..

On 12 October 2016 at 16:30, Jianbin Wei <ji...@netskope.com> wrote:

> You can check this
>
> http://kafka.apache.org/documentation.html#basic_ops_add_topic
>
> But from our experience it is best to delete topics one by one, i.e., make
> sure Kafka is in good shape before and after deleting a topic before
> working on next one.
>
> Regards,
>
> -- Jianbin
>
> > On Oct 11, 2016, at 9:26 PM, Ratha v <vi...@gmail.com> wrote:
> >
> > Thanks..Which bash script I need to run?
> >
> >> On 12 October 2016 at 15:20, Ali Akhtar <al...@gmail.com> wrote:
> >>
> >> The last time I tried, I couldn't find a way to do it, other than to
> >> trigger the bash script for topic deletion programatically.
> >>
> >>> On Wed, Oct 12, 2016 at 9:18 AM, Ratha v <vi...@gmail.com>
> wrote:
> >>>
> >>> Hi all;
> >>>
> >>> I have two topics(source and target). I do some processing on the
> message
> >>> available in the source topic and i merge both topic.
> >>> That is;
> >>>
> >>> builder.stream(sourceTopic).to(targetTopic)
> >>>
> >>> Once merged I no longer require the sourceTopic. I want to delete it.
> >>>
> >>> How can I do that programatically in java? I use highelevel  client
> APIs,
> >>> kafka v 0.10.0.1
> >>>
> >>>
> >>> Thanks
> >>> --
> >>> -Ratha
> >>> http://vvratha.blogspot.com/
> >>>
> >>
> >
> >
> >
> > --
> > -Ratha
> > http://vvratha.blogspot.com/
>



-- 
-Ratha
http://vvratha.blogspot.com/

Re: How can I delete a topic programatically?

Posted by Jianbin Wei <ji...@netskope.com>.
You can check this

http://kafka.apache.org/documentation.html#basic_ops_add_topic

But from our experience it is best to delete topics one by one, i.e., make sure Kafka is in good shape before and after deleting a topic before working on next one.

Regards,

-- Jianbin

> On Oct 11, 2016, at 9:26 PM, Ratha v <vi...@gmail.com> wrote:
> 
> Thanks..Which bash script I need to run?
> 
>> On 12 October 2016 at 15:20, Ali Akhtar <al...@gmail.com> wrote:
>> 
>> The last time I tried, I couldn't find a way to do it, other than to
>> trigger the bash script for topic deletion programatically.
>> 
>>> On Wed, Oct 12, 2016 at 9:18 AM, Ratha v <vi...@gmail.com> wrote:
>>> 
>>> Hi all;
>>> 
>>> I have two topics(source and target). I do some processing on the message
>>> available in the source topic and i merge both topic.
>>> That is;
>>> 
>>> builder.stream(sourceTopic).to(targetTopic)
>>> 
>>> Once merged I no longer require the sourceTopic. I want to delete it.
>>> 
>>> How can I do that programatically in java? I use highelevel  client APIs,
>>> kafka v 0.10.0.1
>>> 
>>> 
>>> Thanks
>>> --
>>> -Ratha
>>> http://vvratha.blogspot.com/
>>> 
>> 
> 
> 
> 
> -- 
> -Ratha
> http://vvratha.blogspot.com/

Re: How can I delete a topic programatically?

Posted by Ratha v <vi...@gmail.com>.
Thanks..Which bash script I need to run?

On 12 October 2016 at 15:20, Ali Akhtar <al...@gmail.com> wrote:

> The last time I tried, I couldn't find a way to do it, other than to
> trigger the bash script for topic deletion programatically.
>
> On Wed, Oct 12, 2016 at 9:18 AM, Ratha v <vi...@gmail.com> wrote:
>
> > Hi all;
> >
> > I have two topics(source and target). I do some processing on the message
> > available in the source topic and i merge both topic.
> > That is;
> >
> > builder.stream(sourceTopic).to(targetTopic)
> >
> > Once merged I no longer require the sourceTopic. I want to delete it.
> >
> > How can I do that programatically in java? I use highelevel  client APIs,
> > kafka v 0.10.0.1
> >
> >
> > Thanks
> > --
> > -Ratha
> > http://vvratha.blogspot.com/
> >
>



-- 
-Ratha
http://vvratha.blogspot.com/

Re: How can I delete a topic programatically?

Posted by Ali Akhtar <al...@gmail.com>.
The last time I tried, I couldn't find a way to do it, other than to
trigger the bash script for topic deletion programatically.

On Wed, Oct 12, 2016 at 9:18 AM, Ratha v <vi...@gmail.com> wrote:

> Hi all;
>
> I have two topics(source and target). I do some processing on the message
> available in the source topic and i merge both topic.
> That is;
>
> builder.stream(sourceTopic).to(targetTopic)
>
> Once merged I no longer require the sourceTopic. I want to delete it.
>
> How can I do that programatically in java? I use highelevel  client APIs,
> kafka v 0.10.0.1
>
>
> Thanks
> --
> -Ratha
> http://vvratha.blogspot.com/
>