#! /bin/bash
function kafka_start(){
for host in pc001 pc002 pc003
do
echo "============启动kafka服务 $host=============="
ssh $host "kafka-server-start.sh -daemon $KAFKA_HOME/config/server.properties"
done
}
function kafka_stop(){
for host in pc001 pc002 pc003
do
echo "============关闭kafka服务 $host=============="
ssh $host "kafka-server-stop.sh"
done
}
case $1 in
"start")
kafka_start;
;;
"stop")
kafka_stop;
;;
"restart")
kafka_stop;
kafka_start;
;;
*)
echo "Invalid Args!";
echo "Usage: xkafka.sh start|stop|restart";
;;