1。启动zookeeper
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties
2.启动kafka
.\bin\windows\kafka-server-start.bat .\config\server.properties
3.创建topic测试主题kafka
.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 3 --topic test5
4.创建生产者产生消息
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test5
5.创建消费者接收消息
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test2 --from-beginning