附录 A 常用命令速查
以下命令均在 Kafka 解压目录执行。请先启动本书 Broker。
查看主题列表:
bin/kafka-topics.sh --bootstrap-server localhost:9092 --list查看订单主题:
bin/kafka-topics.sh --bootstrap-server localhost:9092 \
--describe --topic orders查看消费者组列表和进度:
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--describe --group project-notify查看主题级覆盖配置:
bin/kafka-configs.sh --bootstrap-server localhost:9092 \
--entity-type topics --entity-name orders --describe结束练习时,先在消费者和生产者终端按 Ctrl+C,再停止 Broker。需要再次学习时直接启动 config/book.properties,原数据和组进度仍可继续使用。
如果完全不再需要环境,确认所有进程已停,再通过文件管理器删除专门解压的练习目录。本文不提供自动递归清理命令,以免初学者在错误目录执行。