本文环境kafka_2.11-2.1.1、zookeeper-3.4.6、jdk8
1、下载zookeeper官网下载:https://archive.apache.org/dist/zookeeper/
下载kafka官网下载:https://archive.apache.org/dist/kafka/
2、修改zookeeper配置文件,复制一份zoo_sample.cfg修改为zoo.cfg
3、启动zookeeper,运行D:IT_Softwarekafka_testzookeeper-3.4.6inzkServer.cmd
4、创建目录D:IT_Softwarekafka_testkafkakafka-logs,D:IT_Softwarekafka_testkafkakafka_2.11-2.1.1configserver.properties的log.dirs修改为刚刚的文件夹
5、运行kafka,到D:IT_Softwarekafka_testkafkakafka_2.11-2.1.1目录执行命令.inwindowskafka-server-start.bat .configserver.properties
6、启动生产者,进入D:IT_Softwarekafka_testkafkakafka_2.11-2.1.1inwindows目录运行命令kafka-console-producer.bat --broker-list localhost:9092 --topic helloKafka
7、启动消费者,同样进入D:IT_Softwarekafka_testkafkakafka_2.11-2.1.1inwindows目录运行命令kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic helloKafka
8、生成者生产消息,消费者消费信息
参考文章:https://blog.csdn.net/zhangbeizhen18/article/details/101323691
https://blog.csdn.net/yuzhiqiang_1/article/details/101783754