大数据平台运维脚本


#!/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

注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com