下载压缩包
链接:https://pan.baidu.com/s/1FIsKC1XxlVqh9AmosIMBiA
提取码:jzx5
解压
得到kafka文件夹
修改配置文件
修改conf/consumer.properties
bootstrap.servers=127.0.0.1:9092
修改conf/producer.properties
bootstrap.servers=127.0.0.1:9092
修改conf/server.properties
log.dirs=D:/DevSoftwares/kafka_2.11-2.3.0/kafka-log
zookeeper.connect=127.0.0.1:2181
修改conf/zookeeper.properties
dataDir=D:/DevSoftwares/kafka_2.11-2.3.0/zookeeper_data
启动命令
用cmd命令切换到kafka的目录
# 启动zk
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 --zookeeper 127.0.0.1:2181 --replication-factor 1 --partitions 1 --topic test2
bin\windows\kafka-topics.bat --list --zookeeper 127.0.0.1:2181
bin\windows\kafka-console-producer.bat --broker-list 127.0.0.1:9092 --topic test2
bin\windows\kafka-console-consumer.bat --bootstrap-server 127.0.0.1:2181 --topic test2 --from-beginning
相关kafka原理文章:
https://www.cnblogs.com/xifenglou/p/7251112.html