Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all Kafka 0.10 topics using - -zookeeper flag without access to Zookeeper

I'm using kafka 0.10 without zookeeper. I want to get kafka topics list. This command is not working since we're not using zookeeper: bin/kafka-topics.sh --list --zookeeper localhost:2181. How can I get the same output without zookeeper?

like image 753
SSR Avatar asked Jun 07 '17 06:06

SSR


2 Answers

Kafka uses ZooKeeper so you need to first start a ZooKeeper server if you don't already have one.

If you do not want to install and have a separate zookeeper server, you can use the convenience script packaged with kafka to get a quick-and-dirty single-node ZooKeeper instance.

Starting the single-node Zookeeper instance:

bin/zookeeper-server-start.sh config/zookeeper.properties 

Starting the Kafka Server:

bin/kafka-server-start.sh config/server.properties 

Listing the Topics available in Kafka:

bin/kafka-topics.sh --list --zookeeper localhost:2181 
like image 57
Daniccan Avatar answered Dec 06 '22 06:12

Daniccan


Kafka 2.2 and up

Newer versions of Kafka no longer requires ZooKeeper connection string to list topics, but can directly go via the Kafka brokers. kafka-topics.sh is provided in the bin/ folder when downloading Kafka. To list topics, do the following:

bin/kafka-topics.sh --list --bootstrap-server <BROKER-LIST> 
like image 22
Paul Avatar answered Dec 06 '22 07:12

Paul