1、vi kafka.sh
for i in hdp-1 hdp-2 hdp-3
do
echo "========== $i =========="
ssh $i "source /etc/profile;/root/apps/kafka_2.12-2.2.0/bin/kafka-server-$1.sh -daemon /root/apps/kafka_2.12-2.2.0/config/server.properties"
done
2、设置权限
chmod 777 kafka.sh
3、启动
./kafka.sh start
4、关闭
./kafka.sh stop