启动kafka集群,关闭kafka集群脚本
Posted guoziyi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了启动kafka集群,关闭kafka集群脚本相关的知识,希望对你有一定的参考价值。
启动kafka集群,关闭kafka集群脚本
在$KAFKA_HOME/bin下新建如下脚本文件
start-kafka.sh
#!/bin/bash BROKERS="mini41 mini42 mini43" APPHOME="/home/hadoop/apps/kafka" APP_NAME="kafka_2.10-0.10.1.0" for i in $BROKERS do echo "Starting ${APP_NAME} on ${i} " ssh ${i} "source /etc/profile; nohup sh ${APPHOME}/bin/kafka-server-start.sh ${APPHOME}/config/server.properties > /dev/null 2>&1 &" if [[ $? -ne 0 ]]; then echo "Starting ${APP_NAME} on ${i} is ok" fi done echo All $APP_NAME are started exit 0
stop-kafka.sh
#!/bin/bash BROKERS="mini41 mini42 mini43" APPHOME="/home/hadoop/apps/kafka" APP_NAME="kafka_2.10-0.10.1.0" for i in $BROKERS do echo "Stopping ${APP_NAME} on ${i} " ssh ${i} "source /etc/profile;bash ${APPHOME}/bin/kafka-server-stop.sh" if [[ $? -ne 0 ]]; then echo "Stopping ${APP_NAME} on ${i} is down" fi done echo All $APP_NAME are stopped exit 0
chmod a+x start-kafka.sh
chmod a+x stop-kafka.sh
以上是关于启动kafka集群,关闭kafka集群脚本的主要内容,如果未能解决你的问题,请参考以下文章