#!/usr/bin/bash
echo "群起,群停"
order=$1
if [ $order = "clear" ] ;then
hadoop-daemon.sh stop namenode
hadoop-daemon.sh stop datanode
hadoop-daemon.sh stop secondarynamenode
yarn-daemon.sh stop nodemanager
yarn-daemon.sh stop resourcemanager
ssh liu2 hadoop-daemon.sh stop namenode
ssh liu2 hadoop-daemon.sh stop datanode
ssh liu2 hadoop-daemon.sh stop secondarynamenode
ssh liu2 yarn-daemon.sh stop nodemanager
ssh liu2 yarn-daemon.sh stop resourcemanager
elif [ $order = "start" ] ;then
hadoop-daemon.sh start namenode
hadoop-daemon.sh start datanode
yarn-daemon.sh start nodemanager
ssh liu2 hadoop-daemon.sh start secondarynamenode
ssh liu2 hadoop-daemon.sh start datanode
ssh liu2 yarn-daemon.sh start nodemanager
ssh liu2 yarn-daemon.sh start resourcemanager
else
echo "都不是啊"
fi
#遍历 包含liu liu2这两个字符串的数组
for i in liu liu2
do
echo "========"$i"=============="
ssh $i jps #让每台主机执行jps,并输出
done
hadoop群起群停脚本
最新推荐文章于 2023-03-20 16:15:23 发布