#!/bin/bash
if [ $# -lt 1 ]
then
echo "你需要输入一个参数"
exit;
fi
HADOOP_PATH_BIN="/opt/module/hadoop-3.1.3/bin"
HADOOP_PATH_SBIN="/opt/module/hadoop-3.1.3/sbin"
case $1 in
"start")
echo "==============启动hadoop集群================="
echo "===============启动HDFS======================="
ssh hadoop102 "$HADOOP_PATH_SBIN/start-dfs.sh"
echo "===============启动YARN==vim====================="
ssh hadoop107 "$HADOOP_PATH_SBIN/start-yarn.sh"
echo "===============启动historyserver======================="
ssh hadoop103 "$HADOOP_PATH_BIN/mapred --daemon start historyserver"
;;
"stop")
echo "==============关闭hadoop集群================="
echo "===============关闭historyserver======================="
ssh hadoop103 "$HADOOP_PATH_BIN/mapred --daemon stop historyserver"
echo "===============关闭YARN======================="
ssh hadoop107 "$HADOOP_PATH_SBIN/stop-yarn.sh"
echo "===============关闭HDFS======================="
ssh hadoop102 "$HADOOP_PATH_SBIN/stop-dfs.sh"
;;
*)
echo "你只能输入start 或者 stop"
;;
esac