kafka查看topic和消息内容命令
金蝶云社区-薛孟洋
薛孟洋
1人赞赏了该文章 2万次浏览 未经作者许可,禁止转载编辑于2022年09月20日 11:32:47

1、查询topic,进入kafka目录:
bin/kafka-topics.sh --list --zookeeper localhost:2181

2、查询topic内容:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic topicName --from-beginning

查询topic
./bin/kafka-topics.sh --bootstrap-server hadoop102:9092
创建topic
./bin/kafka-topics.sh --bootstrap-server hadoop102:9092 --create --topic first --partitions 4 --replication-factor 2
查看topic 为 first的 详细信息
./bin/kafka-topics.sh --bootstrap-server hadoop102:9092 --describe --topic first
往topic 为 first 的内部生产消息
./bin/kafka-console-producer.sh --broker-list hadoop102:9092 --topic first
从topic 为first的内部消费消息
./bin/kafka-console-consumer.sh --bootstrap-server hadoop102:9092 --topic first


本文转载自:博客园

作者:deepJL

原文链接:https://www.cnblogs.com/deepJL/p/15030999.html

赞 1