kafka查看topic和消息內容命令


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM