1、集群启动/停止方式总结
1.1、整体启动/停止 HDFS
start-dfs.sh/stop-dfs.sh
1.2、整体启动/停止 YARN
start-yarn.sh/stop-yarn.sh
1.3、分别启动/停止 HDFS 组件
hdfs --daemon start/stop namenode/datanode/secondarynamenode
1.4、启动/停止 YARN
yarn --daemon start/stop resourcemanager/nodemanager
2、Hadoop 集群启停脚本(包含 HDFS ,Yarn ,Historyserver )
if [ $
then
echo "No Args Input..."
exit ;
fi
case $1 in
"start")
echo " =================== 启动 hadoop 集群 ==================="
echo " --------------- 启动 hdfs ---------------"
ssh hadoop102 "/opt/module/hadoop-3.1.3/sbin/start-dfs.sh"
echo " --------------- 启动 yarn ---------------"
ssh hadoop103 "/opt/module/hadoop-3.1.3/sbin/start-yarn.sh"
echo " --------------- 启动 historyserver ---------------"
ssh hadoop102 "/opt/module/hadoop-3.1.3/bin/mapred --daemon start historyserver"
;;
"stop")
echo " =================== 关闭 hadoop 集群 ==================="
echo " --------------- 关闭 historyserver ---------------"
ssh hadoop102 "/opt/module/hadoop-3.1.3/bin/mapred --daemon stop historyserver"
echo " --------------- 关闭 yarn ---------------"
ssh hadoop103 "/opt/module/hadoop-3.1.3/sbin/stop-yarn.sh"
echo " --------------- 关闭 hdfs ---------------"
ssh hadoop102 "/opt/module/hadoop-3.1.3/sbin/stop-dfs.sh"
;;
*)
echo "Input Args Error..."
;;
esac
for host in hadoop102 hadoop103 hadoop104
do
echo =============== $host ===============
ssh $host jps
done
给定权限
chmod 777 myHadoop.sh