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