#!/bin/bash
#author Tom
#time 20160107
#program: all service start program
serviceName="NameNode ResourceManager QuorumPeerMain nimbus DataNode JobHistoryServer NodeManager Kafka logviewer core Master JobHistoryServer"
NowDate=$(date "+%Y%m%d %H:%M:%S")
check()
{
echo date:$NowDate ___serviceName: $serviceName
for prog in $serviceName;
do
count=`jps | grep $prog | grep -v "grep" |wc -l`
if [ 0 == $count ];then
case $prog in
NameNode) ${HADOOP_HOME}/sbin/hadoop-daemon.sh start namenode;;
ResourceManager) ${HADOOP_HOME}/sbin/yarn-daemon.sh start resourcemanager;;
nimbus) nohup ${STORM_HOME}/bin/storm nimbus > /dev/null 2>&1 &;;
QuorumPeerMain) ${ZOOKEEPER_HOME}/bin/zkServer.sh start;;
DataNode) ${HADOOP_HOME}/sbin/hadoop-daemon.sh start datanode;;
JobHistoryServer) ${HADOOP_HOME}/sbin/mr-jobhistory-daemon.sh start historyserver;;
NodeManager) ${HADOOP_HOME}/yarn-daemon.sh start nodemanager;;
Kafka) nohup ${KAFKA_HOME}/bin/kafka-server-start.sh ${KAFKA_HOME}/config/server.properties > /dev/null 2>&1 &;;
logviewer) nohup ${STORM_HOME}/bin/storm logviewer > /dev/null 2>&1 &;;
core) nohup ${STORM_HOME}/bin/storm ui >/dev/null 2>&1 &;;
Master) ${SPARK_HOME}/sbin/start-master.sh;;
Worker) ${SPARK_HOME}/sbin/start-slave.sh spark://master:7077;;
JobHistoryServer) ${SPARK_HOME}/sbin/start-history-server.sh;;
*) echo no;;
esac
echo $prog failed;
else
echo $prog is running;
fi
done
}
main()
{
echo check
check
}
main
大数据平台运维脚本
最新推荐文章于 2024-08-21 08:47:16 发布