集群启动停止方式总结
- 整体启动/停止
HDFS
start-dfs/stop-dfs.sh
- 整体启动/停止
YARN
start-yarn/stop-yarn.sh
- 分别启动/停止
HDFS
组件
hdfs --daemon start/stop namenode/datanode/secondarynamenode
- 启动/停止
YARN
yarn --daemon start/stop resourcemanager/nodemanager
hadoop
常用脚本
hadoop
集群启停脚本(包含HDFS
,Yarn
,Historyserver
):myhadoop.sh
#!/bin/bash
if [ $
then
echo "No Args Input..."
exit ;
fi
chse $1 in
"start")
echo " ==================== 启动 hadoop集群 ===================="
echo " --------------- 启动 hdfs ---------------"
ssh hadoop102 "/opt/module/hadoop-2.7.2/sbin/start-dfs.sh"
echo " --------------- 启动 yarn ---------------"
ssh hadoop103 "/opt/module/hadoop-2.7.2/sbin/start-yarn.sh"
echo " --------------- 启动 historyserver ---------------"
ssh hadoop102 "/opt/module/hadoop-2.7.2/bin/mr-jobhistory-daemon.sh start historyserver"
;;
"stop")
echo " ==================== 关闭 hadoop集群 ===================="
echo " --------------- 关闭 historyserver ---------------"
ssh hadoop102 "/opt/module/hadoop-2.7.2/bin/mr-jobhistory-daemon.sh start historyserver"
echo " --------------- 关闭 yarn ---------------"
ssh hadoop103 "/opt/module/hadoop-2.7.2/sbin/stop-yarn.sh"
echo " --------------- 关闭 hdfs ---------------"
ssh hadoop102 "/opt/module/hadoop-2.7.2/sbin/stop-dfs.sh"
;;
*)
echo "input Args Error..."
;;
esac
[amelia@hadoop102 bin]$ chmod 777 myhadoop.sh
[amelia@hadoop102 hadoop-2.7.2]$ myhadoop.sh start
[amelia@hadoop102 hadoop-2.7.2]$ myhadoop.sh stop
- 查看三台服务器
Java
进程脚本:jspall
#!/bin/bash
for host in hadoop102 hadoop103 hadoop104
do
echo =============== $host ===============
ssh $host jps
done
[amelia@hadoop102 bin]$ chmod 777 jpssll
[amelia@hadoop102 hadoop-2.7.2]$ xsync /home/amelia/bin/