kafka集群启动脚本
#! /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