说明:Hadoop2.2.0集群启动和停止Shell脚本,以下脚本中出现的master,slave1,slave2,slave3均已配host。
startupall.sh
#!/bin/bash
hadoophome="/home/yarn/Hadoop/hadoop-2.2.0/"
ssh slave1 "/bin/bash ${hadoophome}sbin/hadoop-daemon.sh start journalnode"
ssh slave2 "/bin/bash ${hadoophome}sbin/hadoop-daemon.sh start journalnode"
ssh slave3 "/bin/bash ${hadoophome}sbin/hadoop-daemon.sh start journalnode"
ssh master "/bin/bash ${hadoophome}sbin/hadoop-daemon.sh start namenode"
echo "now waiting for 8s security mode "
sleep 8s
ssh slave1 "/bin/bash ${hadoophome}bin/hdfs namenode -bootstrapStandby"
ssh slave1 "/bin/bash ${hadoophome}sbin/hadoop-daemon.sh start namenode"
ssh master "/bin/bash ${hadoophome}bin/hdfs haadmin -transitionToActive nn1"
ssh master "/bin/bash ${hadoophome}sbin/hadoop-daemons.sh start datanode"
ssh master "/bin/bash ${hadoophome}sbin/start-yarn.sh"
ssh slave1 "/bin/bash ${hadoophome}sbin/mr-jobhistory-daemon.sh start historyserver"
shutdownall.sh
#!/bin/bash
hadoophome="/home/yarn/Hadoop/hadoop-2.2.0/"
ssh master "/bin/bash ${hadoophome}sbin/stop-yarn.sh"
ssh master "/bin/bash ${hadoophome}sbin/stop-dfs.sh"
ssh slave1 "/bin/bash ${hadoophome}sbin/mr-jobhistory-daemon.sh stop historyserver"