Kafka3.x集群搭建(Kraft模式)
https://kafka.apache.org/downloads
kafka_2.12-3.1.0.tgz
前期准备
准备3台服务器
HOSTNAME | IP |
---|---|
kraft1 | 192.168.25.101 |
kraft2 | 192.168.25.102 |
kraft3 | 192.168.25.103 |
分别修改三台机器的hostname
#192.168.25.101上执行
hostnamectl set-hostname kraft1
修改/etc/hosts文件(三台机器)
/etc/hosts << EOF
192.168.25.101 kraft1
192.168.25.102 kraft2
192.168.25.103 kraft3
EOF
安装JDK
下载安装包并上传到服务器
解压:
tar zxf kafka_2.12-3.1.0.tgz
安装步骤
-
- 修改kraft/server.properties
kraft1
# The node id associated with this instance's roles node.id=1 # The connect string for the controller quorum controller.quorum.voters=1@192.168.25.101:9093,2@192.168.25.102:9093,3@192.168.25.103:9093 ############################# Socket Server Settings ############################# # The address the socket server listens on. It will get the value returned from # java.net.InetAddress.getCanonicalHostName() if not configured. # FORMAT: # listeners