1.【Xhadoop.sh】启动hadoop集群

#! /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
上一篇:nginx的停止服务&命令


下一篇:java-日常练习-多线程-停止线程方法介绍(stop,interrupt,结合while使用退出标签)