批量启动Kafka,Zookeeper脚本
注意:一定要先配置免密操作
1、start-zk.sh
#!/bin/bash case $1 in "start"){ for i in hadoop102 hadoop103 hadoop101 do echo ---------- zookeeper $i 启动 ------------ ssh $i "/usr/java/zookeeper36/bin/zkServer.sh start" done };; "stop"){ for i in hadoop102 hadoop103 hadoop101 do echo ---------- zookeeper $i 停止 ------------ ssh $i "/usr/java/zookeeper36/bin/zkServer.sh stop" done };; "status"){ for i in hadoop102 hadoop103 hadoop101 do echo ---------- zookeeper $i 状态 ------------ ssh $i "/usr/java/zookeeper36/bin/zkServer.sh status" done };; esac
2、start-kafka.sh
#! /bin/bash case $1 in "start"){ for i in hadoop102 hadoop103 hadoop101 do echo " --------启动 $i Kafka-------" ssh $i "/usr/java/kafka2.3/kafka_2.11-2.3.0/bin/kafka-server-start.sh -daemon /usr/java/kafka2.3/kafka_2.11-2.3.0/config/server.properties" done };; "stop"){ for i in hadoop102 hadoop103 hadoop101 do echo " --------停止 $i Kafka-------" ssh $i "/usr/java/kafka2.3/kafka_2.11-2.3.0/bin/kafka-server-stop.sh stop" done };; esac
本文来自博客园,作者:小白啊小白,Fighting,转载请注明原文链接:https://www.cnblogs.com/ywjfx/p/14991961.html