多台kafka同时启动shell脚本

假设有三台机器,分别为mypc01,mypc02,mypc03

#!/bin/bash

show(){
     
	echo -e "\033[0;37;44m"$1"\033[00m"
}

case $1 in 

start)
for i in mypc01 mypc02 mypc03
do
show "--------------- $i ---------------" 
ssh $i> /dev/null 2>&1 << eof
/usr/local/kafka/bin/kafka-server-start.sh -daemon /usr/local/kafka/config/server.properties
exit
eof
echo "    $i kafka已启动  "
done
;;

stop)
for i in mypc01 mypc02 mypc03
do
show "--------------- $i ---------------"
ssh $i '/usr/local/kafka/bin/kafka-server-stop.sh'
echo "   $i kafka已经关闭 "
done
;;
esac

你可能感兴趣的:(kafka,kafka,shell)