使用 - -zookeeper 标志列出所有 Kafka 0.10 主题,无需访问 Zookeeper [英] List all Kafka 0.10 topics using - -zookeeper flag without access to Zookeeper
问题描述
我使用的是 kafka 0.10,没有 zookeeper.我想获得 kafka 主题列表.此命令不起作用,因为我们没有使用 zookeeper:bin/kafka-topics.sh --list --zookeeper localhost:2181
.如何在没有 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?
推荐答案
Kafka 使用 ZooKeeper,因此如果您还没有 ZooKeeper 服务器,则需要先启动一个 ZooKeeper 服务器.
Kafka uses ZooKeeper so you need to first start a ZooKeeper server if you don't already have one.
如果不想安装和拥有单独的zookeeper服务器,可以使用kafka打包的便捷脚本来搞定一个又快又脏的单节点ZooKeeper实例.
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.
启动单节点 Zookeeper 实例:
bin/zookeeper-server-start.sh config/zookeeper.properties
启动 Kafka 服务器:
bin/kafka-server-start.sh config/server.properties
列出 Kafka 中可用的主题:
bin/kafka-topics.sh --list --zookeeper localhost:2181
这篇关于使用 - -zookeeper 标志列出所有 Kafka 0.10 主题,无需访问 Zookeeper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!