1. 程式人生 > 其它 >關於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