对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
各个集群jps命令查看服务
#!/bin/bash for host in master slave1 slave2 do echo ========== $host =========== ssh $host jps done