简体   繁体   English

Apache Kafka 列出所有主题

[英]Apache Kafka list all Topics

Is this any bug with the Apache Kafka 0.9.0.0?这是 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:这是我用来启动 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.尝试围绕大肆宣传的 Apache Kafka 的基本内容对我来说变得越来越苛刻。 Here is one another example where I'm pretty much stuck!这是另一个我几乎被卡住的例子!

Apache Kafka 0.9.0.0 Show all Topics with Partitions Apache Kafka 0.9.0.0 显示所有带有分区的主题

I don't see the zookeeper started in your code.我没有看到 Zookeeper 在您的代码中启动。 Please start zookeeper and then kafka in the same order.请以相同的顺序启动zookeeper,然后启动kafka。

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.现在您可以尝试使用 list 命令来查看列出的主题。

Note: The replication factor depends upon the number of brokers that you run on a single server.注意:复制因子取决于您在单个服务器上运行的代理数量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM