将kafka单机版安装教程中的1、2步骤进行三次,也就是三个节点
在每个节点文件夹的根目录下,新建log文件夹,然后配置在配置文件中
配置文件中的broker.id,log.dirs,port配置项修改为对应节点自己的
最后,附kafka集群启动、停止、查看状态脚本
#!/bin/bash if?[?-z?$1?];then? echo?command?error,please?specify?start?or?stop?or?status!? exit fi if?[?$1?==?start?];then sh?./kafka_2.11-2.2.2_1/bin/kafka-server-start.sh?-daemon?./kafka_2.11-2.2.2_1/config/server.properties sh?./kafka_2.11-2.2.2_2/bin/kafka-server-start.sh?-daemon?./kafka_2.11-2.2.2_2/config/server.properties sh?./kafka_2.11-2.2.2_3/bin/kafka-server-start.sh?-daemon?./kafka_2.11-2.2.2_3/config/server.properties elif?[?$1?==?stop?];then sh?./kafka_2.11-2.2.2_1/bin/kafka-server-stop.sh sh?./kafka_2.11-2.2.2_2/bin/kafka-server-stop.sh sh?./kafka_2.11-2.2.2_3/bin/kafka-server-stop.sh elif?[?$1?==?status?];then lsof?-i:9093 lsof?-i:9094 lsof?-i:9095 else echo?command?error,please?specify?start?or?stop?or?status! fi
?
原文:https://blog.51cto.com/u_14643435/2855240