kafka自帶命令的使用
1.創建topic:
kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 -- partitions 1 --topic my_test
2.查看所有topic:
kafka-topics.bat --list --zookeeper localhost:2181
3.發送消息:
kafka-console-producer.bat --broker-list localhost:9092 --topic my_test
4.接收消息:
kafka-console-consumer --bootstrap-server localhost:9092 --topic my_test --from-beginning
5.查看topic消息數
kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic test765 --time -1