群起hadoop集群脚本(开启,关闭)

通过执行shell脚本语句,实现群起hadoop集群

1.start.sh

#!bin/bash
echo "=======================正在开启集群服务======================"
echo "=======================正在开启NameNode节点=================="

ssh [email protected] '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh start namenode'

echo "=======================正在开启DataNode节点=================="
for i in [email protected] [email protected] [email protected]
do
	ssh $i '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh start datanode'
done


echo "=======================正在开启SeondaryNameNode节点=================="

ssh [email protected] '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh start secondarynamenode'

echo "=======================正在开启ResourceManager节点=================="

ssh [email protected] '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/yarn-daemon.sh start resourcemanager'

echo "=======================正在开启NodeManager节点=================="

for i in [email protected] [email protected] [email protected]
do
        ssh $i '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/yarn-daemon.sh start nodemanager'
done

2.stop.sh

echo "=======================正在关闭集群服务======================"
echo "=======================正在关闭ResourceManager节点=================="
ssh [email protected] '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/yarn-daemon.sh stop resourcemanager'
echo "=======================正在关闭NodeManager节点=================="
for i in [email protected] [email protected] [email protected]
do
        ssh $i '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/yarn-daemon.sh stop nodemanager'
done
echo "=======================正在关闭NameNode节点=================="

ssh [email protected] '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh stop namenode'

echo "=======================正在关闭SeondaryNameNode节点=================="

ssh [email protected] '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh stop secondarynamenode'

echo "=======================正在关闭DataNode节点=================="
for i in [email protected] [email protected] [email protected]
do
	ssh $i '/opt/modules/hadoop-2.5.0-cdh5.3.6/sbin/hadoop-daemon.sh stop datanode'
done

 

启动方式:

sh start.sh

sh stop.sh

你可能感兴趣的:(总结,hdfs)