配置kafkaServer.properts文件是为了为kafka集群的部署和使用做准备
- 如果你的测试服务器只有一台,则你只能进行伪集群部署
- 备份server.properties文件
cp server.properties ./server-1.properties
cp server.properties ./server-2.properties
cp server.properties ./server-3.properties
- 修改配置文件
-
config/server-1.properties:
broker.id=1 listeners=PLAINTEXT://:9093 log.dir=/usr/local/kafka/data/kafka-logs-1
-
config/server-2.properties:
broker.id=2 listeners=PLAINTEXT://:9094 log.dir=/usr/local/kafka/data/kafka-logs-2
-
config/server-3.properties:
broker.id=3 listeners=PLAINTEXT://:9095 log.dir=/usr/local/kafka/data/kafka-logs-3
-启动kafka伪集群
./bin/kafka-server-start.sh -daemon config/server1.properties
./bin/kafka-server-start.sh -daemon config/server2.properties
./bin/kafka-server-start.sh -daemon config/server3.properties
- 查看zookeeper/bokers/ids 借点下面时候有四个分区
伪集群部署成功