版本:kafka_2.11-2.1.1
下载地址:http://mirrors.hust.edu.cn/apache/kafka/2.1.1/kafka_2.11-2.1.1.tgz
准备:zookeeper已经启动好伪集群
1.修改server.properties文件
broker.id=1
listeners=PLAINTEXT://127.0.0.1:9092
log.dirs=D:\kafkas\kafka1
zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
broker.id=2
listeners=PLAINTEXT://127.0.0.1:9093
log.dirs=D:\kafkas\kafka2
zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
broker.id=3
listeners=PLAINTEXT://127.0.0.1:90924
log.dirs=D:\kafkas\kafka3
zookeeper.connect=127.0.0.1:2181,127.0.0.1:2182,127.0.0.1:2183
2.修改bin\windows\kafka-run-class.bat文件
set COMMAND=%JAVA% %KAFKA_HEAP_OPTS% %KAFKA_JVM_PERFORMANCE_OPTS% %KAFKA_JMX_OPTS% %KAFKA_LOG4J_OPTS% -cp %CLASSPATH% %KAFKA_OPTS% %*
set COMMAND=%JAVA% %KAFKA_HEAP_OPTS% %KAFKA_JVM_PERFORMANCE_OPTS% %KAFKA_JMX_OPTS% %KAFKA_LOG4J_OPTS% -cp "%CLASSPATH%" %KAFKA_OPTS% %*
在%CLASSPATH%加上引号
3.启动方式
进入kafka文件夹下运行此命令
.\bin\windows\kafka-server-start.bat .\config\server.properties
如果可行请给我个赞 原创不易!!!