wget https://dlcdn.apache.org/kafka/3.0.0/kafka_2.12-3.0.0.tgz
tar -zxvf kafka_2.12-3.0.0.tgz
cd kafka_2.12-3.0.0/config vim zookeeper.properties
修改
dataDir=/kafka/kafka_2.12-3.0.0/zookeeper
添加
dataLogDir=/kafka/kafka_2.12-3.0.0/log/zookeeper tickTime=2000 #为zk的基本时间单元,毫秒 initLimit=10 #Leader-Follower初始通信时限 tickTime*10 syncLimit=5 #Leader-Follower同步通信时限 tickTime*5 server.0=node1IP:2888:3888 server.1=node2IP:2888:3888 server.2=node3IP:2888:3888
将改配置文件复制到其他两个节点上
创建文件夹
mkdir -pv /kafka/kafka_2.12-3.0.0/zookeeper mkdir -pv /kafka/kafka_2.12-3.0.0/log/zookeeper mkdir -pv /kafka/kafka_2.12-3.0.0/log/kafka
添加myid
分别在三台机器上的/kafka/kafka_2.12-3.0.0/zookeeper添加myid文件,内容为上方配置的server后面的序号,如node1IP上内容为0,node2IP上内容为1
修改解压目录config下的server.properties文件
broker.id=1 #三台机器不能一样 advertised.listeners=PLAINTEXT://172.16.10.91:9092 #三台机器分别配置成为各自的ip zookeeper.connect=172.22.75.126:2181,172.25.147.22:2181,172.25.147.21:2181 #三台机器相同,根据自己的服务器配置 log.dirs=/kafka/kafka-3.0.0-src/log/kafka #三台机器相同 num.partitions=3 #三台机器相同
cd /kafka/kafka_2.12-3.0.0 bin/zookeeper-server-start.sh config/zookeeper.properties &
bin/kafka-server-start.sh config/server.properties &
https://github.com/yahoo/CMAK/releases
unzip cmak-3.0.0.5.zip
cd /kafka/cmak-3.0.0.5/conf vim application.conf
修改为
kafka-manager.zkhosts="172.22.75.126:2181,172.25.147.22:2181,172.25.147.21:2181" cmak.zkhosts="172.22.75.126:2181,172.25.147.22:2181,172.25.147.21:2181" basicAuthentication.enabled=true basicAuthentication.enabled=${?KAFKA_MANAGER_AUTH_ENABLED} basicAuthentication.username="admin" basicAuthentication.username=${?KAFKA_MANAGER_USERNAME} basicAuthentication.password="admin" basicAuthentication.password=${?KAFKA_MANAGER_PASSWORD} basicAuthentication.realm="Kafka-Manager"
bin/cmak &
http://IP:9000/
问题 启动完成后突然发现没有管理已经启动的kafka,经查询发现目前只支持到kafka2.4,安装的kafka是3.0的,但是可以从kafka-manager中创建2.4的kafka