赞
踩
1.下载kafka
https://kafka.apache.org/downloads
2.解压
tar -zxvf kafka_2.11-2.2.1.tgz -C /opt
3.修改配置文件
cd kafka_2.11-2.2.1
vi ./config/server.properties
将broker.id=0改为
broker.id=1
将log.dirs=/tmp/kafka-logs改为 log.dirs=/
4.启动zookeeper
./bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
5.启动kafka
./bin/kafka-server-start.sh config/server.properties
报错提示
/opt/kafka_2.11-2.2.1/bin/kafka-run-class.sh: 第 306 行:exec: java: 未找到
kafka需要java环境,查看jdk是否安装
java -version
安装Open JDK
搜索JDK yum 源
yum search java | grep jdk
使用yum安装open JDK
yum install -y java-1.8.0-openjdk
再次启动kafka
./bin/kafka-server-start.sh config/server.properties
报错信息,提示2181端口无法连接
O Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-06-20 10:00:28,276] INFO Socket error occurred: localhost/127.0.0.1:2181: 拒绝连接 (org.apache.zookeeper.ClientCnxn)
[2019-06-20 10:00:29,380] INFO Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2019-06-20 10:00:29,383] INFO Socket error occurred: localhost/0:0:0:0:0:0:0:1:2181: 拒绝连接 (org.apache.zookeeper.ClientCnxn)
[2019-06-20 10:00:30,484] INFO Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
查看zookeeper是否启动成功
netstat -ntpl
启动zookeeper
./bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
启动kafka
./bin/kafka-server-start.sh config/server.properties
安装成功
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。