#! /bin/bash case $1 in # 启动 “start”) for host in hadoop101 hadoop102 hadoop103 do echo “*********** start host kafka ***********” ssh $host “/opt/module/kafka/bin/kafka-server-start.sh -daemon /opt/module/kafka/config/server.properties” done ;; “stop”) for host in hadoop101 hadoop102 hadoop103 do echo “*********** start host kafka ***********” ssh $host “/opt/module/kafka/bin/kafka-server-stop.sh” done ;; “status”) for host in hadoop101 hadoop102 hadoop103 do echo “*********** start host kafka ***********” pid=$(ssh $host “ps -ef|grep kafka|grep -v grep”) ["$pid"] && echo “kafka运行正常”|| echo “未找到kafka进程或者kafka运行异常” done ;; *) echo “错误参数!” ;; esac
标签:脚本,opt,module,echo,start,host,集群,kafka From: https://www.cnblogs.com/Jace06/p/16802154.html