Hadoop一键启动脚本
jps>tmp.txt
NN=`cat tmp.txt|grep -w NameNode`
DN=`cat tmp.txt|grep -w DataNode`
SNN=`cat tmp.txt|grep -w SecondaryNameNode`
RM=`cat tmp.txt|grep -w ResourceManager`
NM=`cat tmp.txt|grep -w NodeManager`
JHS=`cat tmp.txt|grep -w JobHistoryServer`
if [ ! ${NN} && ! ${DN} && ! ${SNN} ];then
start-dfs.sh
else
stop-dfs.sh
start-dfs.sh
fi
if [ ! ${RM} && ! ${NM} ];then
start-yarn.sh
else
stop-yarn.sh
start-yarn.sh
fi
if [ ! ${JHS} ];then
mapred --daemon start historyserver
fi
unset JHS
unset NM
unset RM
unset SNN
unset DN
unset NN
rm -f tmp.txt