kafka 的介绍我就不赘述了,本人理解不深,为实现sping-cloud配置自动刷新使用kafka,总结如下:
一、下载最新版本,我用的是2.12-2.2.1 http://kafka.apache.org/downloads
二、安装
1、解压到:E:\softinstall\kafka_2.12-2.2.1
2、新建目录:E:\softinstall\kafka_2.12-2.2.1\logs
3、修改配置文件:E:\softinstall\kafka_2.12-2.2.1\config\server.properties
log.dirs=E:/softinstall/kafka_2.12-2.2.1/logs
4、启动
(1)新建cmd窗口,目录:E:\softinstall\kafka_2.12-2.2.1\bin\windows 执行: zookeeper-server-start.bat ..\..\config\zookeeper.properties
(2)新建cmd窗口,目录:E:\softinstall\kafka_2.12-2.2.1\bin\windows 执行: kafka-server-start.bat ..\..\config\server.properties
(3)新建cmd窗口,目录:E:\softinstall\kafka_2.12-2.2.1\bin\windows 执行:kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic pp
(4)新建cmd窗口,目录:E:\softinstall\kafka_2.12-2.2.1\bin\windows 执行:kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic pp --from-beginning
(5)新建cmd窗口,目录:E:\softinstall\kafka_2.12-2.2.1\bin\windows 执行:kafka-console-producer.bat --broker-list localhost:9092 --topic pp
(6)在窗口(5)中输入 hello 查看窗口(4)的输出结果。