2

I would like to view all the topics running on a server from my local kafka scripts. I can view the details of a topic like this:

bin/kafka-console-consumer.sh --bootstrap-server <someip>:<somport> --topic  
mytopic --from-beginning

But can't find out a way to view all the topics running on <someip>:<someport>. Do I need to have a local instance of zookeeper running in order to do this?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Anthony
  • 33,838
  • 42
  • 169
  • 278

1 Answers1

1

If i understand the question correctly you can just use:

kafka-topics.sh --list --zookeeper remote-zookeeper:2181

and replace the ip and port in the command above. it is as simple as this assuming that the kafka cluster does not require authentication - authorization etc

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
giannisapi
  • 2,641
  • 3
  • 24
  • 31
  • the ip and port in my `kafka-console-consumer.sh` is for one of the kafka nodes. not for the zookeeper. For the `kafka-topics.sh` do I need ip and port for zookeeper running on the server?? – Anthony Jan 10 '19 at 15:13
  • 1
    @Anthony: Yes, `kafka-topics.sh` needs to communicate with the zookeeper at the moment to list the topics. This reliance on ZK is being addressed with [KIP-377](https://cwiki.apache.org/confluence/display/KAFKA/KIP-377%3A+TopicCommand+to+use+AdminClient) – Chris Matta Jan 10 '19 at 15:59