我采用的是外部的zookeeper,而不是kafka自带的
如不知道安装zookeeper的参考:https://blog.csdn.net/weixin_36104843/article/details/80211404
1.下载
wget http://mirrors.hust.edu.cn/apache/kafka/1.1.0/kafka_2.12-1.1.0.tgz
2.解压
tar -zxvf kafka_2.12-1.1.0.tgz
3.复制到/usr/local/下面
mv kafka_2.12-1.1.0 /usr/local/kafka
4.修改Kafka服务端配置文件server.properties(最重要配置:broker.id、log.dirs、zookeeper.connect)
cd /usr/local/kafka/conf
nano server.properties
# 设置节点id,如果是集群这里的id要按照顺序该相应的改成0,1,2,3,....
broker.id=0
# 设置日志文件目录
log.dirs=/usr/local/kafka/logs
# 设置zookeeper连接地址
zookeeper.connect=master01:2181,master02:2181,slaver01:2181,slaver02:2181
5.确保你的zookeeper已经启动了然后启动kafka
cd /usr/local/kafka/bin
./kafka-server-start.sh /usr/local/kafka/config/server.properties 1>/dev/null 2>&1 &
参考:https://blog.csdn.net/laravelshao/article/details/79773008