新建kf.sh 文件
#!/bin/bash
case $1 in
"start"){
for i in Bigdata04 Bigdata05 Bigdata06
do
echo ---------- kafka $i 启动 ------------
ssh $i "/opt/module/kafka/bin/kafka-server-start.sh -daemon /opt/module/kafka/config/server.properties"
done
};;
"stop"){
for i in Bigdata04 Bigdata05 Bigdata06
do
echo ---------- kafka $i 停止 ------------
ssh $i "/opt/module/kafka/bin/kafka-server-stop.sh -daemon /opt/module/kafka/config/server.properties"
done
};;
esac
注意,写脚本之前,一定要修改 :
https://blog.csdn.net/weixin_45417821/article/details/108134213
|