Hadoop教程

关于Hadoop启动和结束脚本

本文主要是介绍关于Hadoop启动和结束脚本,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Hadoop启动结束
  1. 对hdfs ,yarn,historyserver服务的启动,结束

#!/bin/bash
​
if [ $# -lt 1 ]
then
    echo "No Args Input..."
    exit;
fi
​
case $1 in
"start")
        echo "=========启动 Hadoop集群=========="
​
        echo "---------启动 hdfs----------"
        ssh master "/opt/module/hadoop-3.1.3/sbin/start-dfs.sh"
        echo "---------启动 yarn----------"
        ssh slave1 "/opt/module/hadoop-3.1.3/sbin/start-yarn.sh"
        echo "---------启动 historyserver----------"
        ssh master "/opt/module/hadoop-3.1.3/bin/mapred --daemon starts historyserver"
;;
"stop")
        echo "=========关闭 Hadoop集群=========="
​
        echo "---------关闭 historyserver----------"
        ssh master "/opt/module/hadoop-3.1.3/bin/mapred --daemon stop historyserver"
        echo "---------关闭 yarn----------"
        ssh slave1 "/opt/module/hadoop-3.1.3/sbin/stop-yarn.sh"
        echo "---------关闭 hdfs----------"
        ssh master "/opt/module/hadoop-3.1.3/sbin/stop-dfs.sh"
;;
*)
    echo "Input Args Error..."
;;
esac
  1. 各个集群jps命令查看服务

#!/bin/bash
​
for host in master slave1 slave2
do
        echo ========== $host ===========
        ssh $host jps
done



这篇关于关于Hadoop启动和结束脚本的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!