Windows Configures Kafka Environment (depending on ZooKeeper, Kafka built-in)

说明:
kafka依赖java环境,需要先安装jdk并在cmd中运行java -version 能够正常显示java版本号

1.下载kafka (版本:kafka_2.12-2.3.0):
http://kafka.apache.org/downloads.html

2.解压后修改zookeeper配置文件: kafka_2.12-2.3.0\config\zookeeper.properties
dataDir=D:\Env\kafka_2.12-2.3.0\data

3 .启动zookeeper:
.\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties

4.修改kafka服务端配置文件: kafka_2 .12-2.3.0\config\server.properties
log.dirs=D:\Env\kafka_2.12-2.3.0\kafka-logs

5.启动kafka:
.\bin\windows\kafka-server-start.bat .\config\server.properties
启动失败:可清理zookeeper生成的数据重试

6. Consumer and producer client start up consumer cli: .\bin\windows\kafka-console-consumer.bat –bootstrap-server 127.0.0.1:9092 –topic nginx_log –from-beginning producer cli: .\bin\windows\kafka-console-producer.bat –broker-list 127.0.0.1:9092 –topic nginx_log

Leave a Comment

Your email address will not be published.