hadoop集群启动脚本

hadoop集群启动脚本,第1张

hadoop集群启动脚本

 1.hadoop集群启动脚本

#!/bin/bash
# 判断参数个数
if [ $# -ne 1 ];then
 echo "need one param, but given $#"
fi

#  *** 作hadoop
case  in
"start")
	echo " ========== 启动hadoop集群 ========== "
	echo ' ---------- 启动 hdfs ---------- '
	ssh node1 "/develop/server/hadoop-2.7.5/sbin/start-dfs.sh"
	echo ' ---------- 启动 yarn ---------- '
	ssh node1 "/develop/server/hadoop-2.7.5/sbin/start-yarn.sh"
	echo ' ---------- 启动 historyserver ---------- '
	ssh node1 "/develop/server/hadoop-2.7.5/sbin/mr-jobhistory-daemon.sh start historyserver"
	;;
"stop")
	echo " ========== 关闭hadoop集群 ========== "
	echo ' ---------- 关闭 historyserver ---------- '
	ssh node1 "/develop/server/hadoop-2.7.5/sbin/mr-jobhistory-daemon.sh stop historyserver"
	echo ' ---------- 关闭 yarn ---------- '
	ssh node1 "/develop/server/hadoop-2.7.5/sbin/stop-yarn.sh"
	echo ' ---------- 关闭 hdfs ---------- '
	ssh node1 "/develop/server/hadoop-2.7.5/sbin/stop-dfs.sh"
	;;
*)
	echo "Input Param Error ..."
	;;
esac

2.jps命令封装,一键查询集群相关服务启动情况

#!/bin/bash
for host in node1 node2 node3
do
  echo " ========== $host =========="
  ssh $host jps
done

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5665405.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存