第一步,启动zookeeper
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
第二步,启动kafka
.\bin\windows\kafka-server-start.bat .\config\server.properties
第三,创建topic命令
.\bin\windows\kafka-topics.bat --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
第四,创建生产者
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test
第五,创建消费者
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning
查看主题命令
.\bin\windows\kafka-topics.bat --list --bootstrap-server localhost:9092