其他分享
首页 > 其他分享> > 01_hadoop集群启停脚本&批量检查集群服务

01_hadoop集群启停脚本&批量检查集群服务

作者:互联网

[root@hadoop01 software]# cat myhadoop.sh 
#!/bin/bash
#检查脚本参数个数
if [ $# -lt 1 ]
then
    echo "No Args Input... please input [start|stop]"
fi

case $1 in 
"start")
        echo " ============================= 启动 hadoop 集群 ================================="
        
        echo " ----------------------------- 启动 hdfs ----------------------------------------"
        ssh hadoop01 "/home/software/hadoop-3.1.3/sbin/start-dfs.sh"
        echo " ----------------------------- 启动 yarn -----------------------------------------"
        ssh hadoop02 "/home/software/hadoop-3.1.3/sbin/start-yarn.sh"
        echo " ----------------------------- 启动 historyserver --------------------------------"
        ;;
"stop")
        echo " ============================= 关闭 hadoop 集群 ================================="

        echo " ----------------------------- 关闭 historyserver --------------------------------"
  
        echo " ----------------------------- 关闭 yarn -----------------------------------------"
        ssh hadoop02 "/home/software/hadoop-3.1.3/sbin/stop-yarn.sh"
        echo " ----------------------------- 关闭 hdfs ----------------------------------------"
        ssh hadoop01 "/home/software/hadoop-3.1.3/sbin/stop-dfs.sh"
        ;;
*)
        echo "Input Args Error... please input [start|stop]"
;;
esac

-- 批量检查集群服务

[root@hadoop01 software]# cat jpsall
#!/bin/bash

for host in hadoop01 hadoop02 hadoop03
do
        echo "=============== $host ====================="
        ssh $host jps
done

 

标签:01,hadoop01,hadoop,echo,start,-----------------------------,集群,software
来源: https://www.cnblogs.com/bajiaotai/p/15165979.html