一键启动集群的shell脚本,包括HDFS HA + YARN相关所有程序,FBI00X是主机名,供大家参考:
#!/bin/bash
echo "-------------------------Step1----------------------------"
echo "Now,starting Zookeeper."
ssh FBI001 $ZOOKEEPER_HOME/bin/zkServer.sh start
ssh FBI002 $ZOOKEEPER_HOME/bin/zkServer.sh start
ssh FBI003 $ZOOKEEPER_HOME/bin/zkServer.sh start
ssh FBI001 $ZOOKEEPER_HOME/bin/zkServer.sh status
ssh FBI002 $ZOOKEEPER_HOME/bin/zkServer.sh status
ssh FBI003 $ZOOKEEPER_HOME/bin/zkServer.sh status
echo "Now,Zookeeper is started."
echo "-------------------------Step2----------------------------"
echo "Now,starting ZKFC."
ssh FBI001 $HADOOP_HOME/sbin/hadoop-daemon.sh start zkfc
ssh FBI002 $HADOOP_HOME/sbin/hadoop-daemon.sh start zkfc
echo "Now,ZKFC started."
echo "-------------------------Step3----------------------------"
echo "Now,starting JN."
ssh FBI001 $HADOOP_HOME/sbin/hadoop-daemon.sh start journalnode
ssh FBI002 $HADOOP_HOME/sbin/hadoop-daemon.sh start journalnode
ssh FBI003 $HADOOP_HOME/sbin/hadoop-daemon.sh start journalnode
echo "Now,JN started."
echo "-------------------------Step4----------------------------"
echo "Now,starting Active,Standby NN."
ssh FBI001 $HADOOP_HOME/sbin/hadoop-daemon.sh start namenode
ssh FBI002 $HADOOP_HOME/sbin/hadoop-daemon.sh start namenode
echo "Now,Active,Standby NN started."
echo "-------------------------Step5----------------------------"
echo "Now,starting DataNodes."
ssh FBI001 $HADOOP_HOME/sbin/hadoop-daemons.sh start datanode
echo "Now,DataNodes started."
echo "-------------------------Step6----------------------------"
echo "Now,starting YARN."
ssh FBI003 $HADOOP_HOME/sbin/start-yarn.sh
echo "Now,YARN started."
echo "-------------------------Step7----------------------------"
echo "Now,starting MR JobHistory Server."
ssh FBI004 $HADOOP_HOME/sbin/mr-jobhistory-daemon.sh start historyserver
echo "Now,MR JobHistory Server started."