#!/bin/bash if [ $# -lt 1 ] then echo "No Args Input..." exit; fi case $1 in "start") echo " =================== 启动Hadoop集群 ===================" echo " ------------------- 启动HDFS -------------------" ssh hadoop102 "/opt/module/hadoop-2.7.2/sbin/start-dfs.sh" echo " ------------------- 启动YARN -------------------" ssh hadoop103 "/opt/module/hadoop-2.7.2/sbin/start-yarn.sh" ;; "stop") echo " =================== 关闭Hadoop集群 ==================" echo " ------------------- 关闭YARN ------------------" ssh hadoop103 "/opt/module/hadoop-2.7.2/sbin/stop-yarn.sh" echo " ------------------- 关闭HDFS ------------------" ssh hadoop102 "/opt/module/hadoop-2.7.2/sbin/stop-dfs.sh" ;; *) esac