Apache Kafka list all Topics
Asked Answered
L

2

5

Is this any bug with the Apache Kafka 0.9.0.0? I'm using the following command to list the topics and I get nothing even though the server was started with a topic being created!

Joes-MacBook-Pro:kafka_2.11-0.9.0.0 joe$ bin/kafka-topics.sh --list --zookeeper localhost:2181
Joes-MacBook-Pro:kafka_2.11-0.9.0.0 joe$ 

Here is the command that I used to start Apache Kafka:

bin/kafka-server-start.sh config/server.properties & bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test_topic

It is getting harsh for me to just try out the basic stuff around the much hyped Apache Kafka. Here is one another example where I'm pretty much stuck!

Apache Kafka 0.9.0.0 Show all Topics with Partitions

Lindley answered 18/1, 2016 at 9:24 Comment(1)
Kafka 0.9 was recently released and may contain bugs. We are successfully running 0.8.2 in production. Is that an option you can consider?Disarray
C
12

I don't see the zookeeper started in your code. Please start zookeeper and then kafka in the same order.

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

Try to list the topics with the below command.

bin/kafka-topics.sh --list --zookeeper localhost:2181

You can create the topic with the below command

bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic test --partitions 1 --replication-factor 1

Once the topic is created, you get a message saying "test" created. Now you can try list command to see your topic listed.

Note: The replication factor depends upon the number of brokers that you run on a single server.

Commit answered 5/8, 2016 at 8:50 Comment(0)
M
2

For someone who comes looking for this in 2024, the useful option is below -

$ bin/kafka-topics.sh --list --bootstrap-server localhost:9092

Mantis answered 27/6 at 18:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.