大数据平台运维脚本

#!/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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值