标签:$1 hup 脚本 main 输出 集群 ash 文件权限 权限
cd /home/hadoop/bin
vi kafka.sh
#输入以下内容
#!/bin/bash
case $1 in
"start" ){
for(( i = 1;i <= 3;i = $i +1));do
echo ============ hadoop0$i kafka $1 ===================
ssh hadoop$i "source /etc/profile;nohup kafka-server-start.sh /bigdata/install/kafka/config/server.properties >/dev/null 2>&1 &"
done
};;
"stop" ){
for(( i = 1;i <= 3;i = $i +1));do
echo ============ hadoop0$i kafka $1 ===================
ssh hadoop$i "source /etc/profile;kafka-server-stop.sh"
done
};;
esac
chmod 777 kafka.sh
# 先确保已经启动了zookeeper
kafka.sh start
xcall jps
# 输出以下内容
============= hadoop1 jps =============
9616 Jps
9267 Kafka
9191 QuorumPeerMain
============= hadoop2 jps =============
8291 Kafka
8213 QuorumPeerMain
8632 Jps
============= hadoop3 jps =============
7129 Kafka
7053 QuorumPeerMain
7470 Jps
kafka.sh stop
xcall jps
# 输出以下内容
============= hadoop1 jps =============
9191 QuorumPeerMain
9740 Jps
============= hadoop2 jps =============
8213 QuorumPeerMain
8748 Jps
============= hadoop3 jps =============
7585 Jps
7053 QuorumPeerMain
标签:$1 hup 脚本 main 输出 集群 ash 文件权限 权限
原文地址:https://www.cnblogs.com/tenic/p/14906807.html