1.kafka下载地址:http://kafka.apache.org/downloads
解压:kafka_2.12-2.6.0.tgz
2.配置zookeeper
进入config目录找到文件zookeeper.properties
3.配置kafka ,修改日志路径为本地路径
进入config目录找到文件server.properties
4.启动zookeep
D:kafka_2.12-2.6.0inwindows>zookeeper-server-start.bat ....configzookeeper.properties
5.启动kafka
D:kafka_2.12-2.6.0inwindows>kafka-server-start.bat ....configserver.properties
6.创建Topic
D:kafka_2.12-2.6.0inwindows>kafka-topics.bat --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
Created topic test.
7.查看Topic
D:kafka_2.12-2.6.0inwindows>kafka-topics.bat --list --bootstrap-server localhost:9092
8.启动生产者 producer
D:kafka_2.12-2.6.0inwindows>kafka-console-producer.bat --broker-list localhost:9092 --topic test
9.启动消费者 customer
D:kafka_2.12-2.6.0inwindows>kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning