kafka安装(我是用docker搭建了三个centos装的)
先安装zookeeper
zookeeper安装
1.三台机器 分别安装jdk (jdk1.8.0_351)
cd /opt/software
tar -zxvf jdk-8u351-linux-x64.tar.gz -C /opt/module/
yum -y install vim
配置环境变量 /etc/profile
export JAVA_HOME=/opt/module/jdk1.8.0_351
export PATH=$PATH:$JAVA_HOME/bin
环境变量生效
source /etc/profile
2.安装zookeeper
tar -zxvf apache-zookeeper-3.5.7-bin.tar.gz -C /opt/module/
mv zoo_sample.cfg zoo.cfg
conf/zoo_cfg 配置
数据存储路径 dataDir=/opt/module/zookeeper-3.5.7/zkData
集群信息
server.1=172.17.0.3:2888:3888
server.2=172.17.0.4:2888:3888
server.3=172.17.0.5:2888:3888
【问题】:左右端口都配成3888 遇到报错client and election port must be different!
在zookeeper-3.5.7 目录下
启动命令 bin/zkServer.sh start
kafka安装
tar -zxvf kafka_2.12-3.0.0.tgz -C /opt/module/
mv kafka-3.0.0-src kafka
在config/server.properties修改配置
1)broker.id=0 三台不一致
2)数据存储路径 /opt/module/kafka/datas
3)zookeeper 172.17.0.3:2181,172.17.0.4:2181,172.17.0.5:2181/kafka
修改环境变量
export KAFKA_HOME=/opt/module/kafka
export PATH=$PATH:$KAFKA_HOME/bin
环境变量生效
source /etc/profile
kafka启动命令:
bin/kafka-server-start.sh -daemon config/server.properties
【注意】先停kafka 再停zookeeper
先启动zookeeper,再启动kafka,用jps命令看一下是否有:
Kafka QuorumPeerMain Jps
标签:opt,bin,教程,zookeeper,module,kafka,集群,172.17 From: https://www.cnblogs.com/yxj808/p/16996562.html