kafka支持两种模式的集群搭建:可以在单机上运行多个broker实例来实现集群,也可以在多台机器上搭建集群。
在kafka运行环境已搭建的基础上再经过如下配置,启动多个broker即可
一、拷贝server.properties文件(DOS命令)
cd /d F:\kafkaRun\kafka_2.11-1.1.0\config
copy server.properties server-1.properties
copy server.properties server-2.properties
二、修改配置文件
config/server-1.properties:
broker.id=1
listeners=PLAINTEXT://:9093
log.dirs=F:\kafkaRun\kafka_2.11-1.1.0\kafka-logs-1
config/server-2.properties:
broker.id=2
listeners=PLAINTEXT://:9094
log.dirs=F:\kafkaRun\kafka_2.11-1.1.0\kafka-logs-2
三、启动新增的broker
cd /d F:\kafkaRun\kafka_2.11-1.1.0\
.\bin\windows\kafka-server-start.bat .\config\server.properties
.\bin\windows\kafka-server-start.bat .\config\server-1.properties
.\bin\windows\kafka-server-start.bat .\config\server-2.properties
到这里单机多broker实例的集群配置就完成了。
版权声明:本文为NN_nan原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。