hadoop启动脚本
记录一下一个简单的hadoop启动脚本
就是启动zookeeper集群,hadoop的HDFS和YRAN的脚本
start-cluster.sh
关于关闭的脚本,只需要顺序换一下,然后将start改为stop
#!/bin/bash
# 集群IP地址
hadoop001=IP地址
hadoop002=IP地址
hadoop003=IP地址
# 输出提示信息
echo "--------------------正在启动集群----------------------"
echo "--------------------zookeeper集群启动----------------------"
for host in hadoop001 hadoop002 hadoop003
do
# 具体逻辑
echo "ssh to $host"
ssh $host "/program/apache-zookeeper-3.5.8-bin/bin/zkServer.sh start"
ssh $host "jps"
# 输出提示
echo "启动成功!!!"
#结束
done
#启动HDFS集群
echo "--------------------HDFS集群启动----------------------"
echo "ssh to $hadoop001"
ssh $hadoop001 "/program/hadoop-3.2.1/sbin/start-dfs.sh"
## 查看jps进程,这一段其实可以不用
#for jps in hadoop001 hadoop002 hadoop003
#do
# echo "查看进程 $jps"
# ssh $jps "jps"
# echo "$jps HDFS启动成功"
# echo "--------------------分割线----------------------"
#done
#启动YARN集群,还有启动historyserver
echo "--------------------YARN集群及history启动----------------------"
echo "ssh to $hadoop002"
ssh $hadoop002 "/program/hadoop-3.2.1/sbin/start-yarn.sh"
ssh $hadoop002 "/program/hadoop-3.2.1/bin/mapred --daemon start historyserver"
echo "JobHistoryServer进程启动成功"
-- 插入 --