#! /bin/bash
if [ $# -lt 1 ]
then
echo "Tips:请输入参数"
exit
fi
case $1 in
"start")
echo "=================启动集群========================"
echo "-----------------启动历史服务器-----------"
ssh pc001 "mapred --daemon start historyserver"
echo "-----------------启动HDFS-----------------"
ssh pc001 "$HADOOP_HOME/sbin/start-dfs.sh"
echo "-----------------启动YARN-----------------"
ssh pc002 "$HADOOP_HOME/sbin/start-yarn.sh"
;;
"stop")
echo "=================关闭集群========================"
echo "-----------------关闭HDFS-----------------"
ssh pc001 "$HADOOP_HOME/sbin/stop-dfs.sh"
echo "-----------------关闭YARN-----------------"
ssh pc002 "$HADOOP_HOME/sbin/stop-yarn.sh"
echo "-----------------关闭历史服务器-----------"
ssh pc001 "mapred --daemon stop historyserver"
;;
*)
echo "Error:请输入正确的参数"
echo "参数 start: 启动集群"
echo "参数 stop : 关闭集群"
;;
esac
1.【Xhadoop.sh】启动hadoop集群
最新推荐文章于 2024-08-31 21:19:14 发布