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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)