Advertisement

启动hive metastore及hiveserver2服务脚本

阅读量:

创建脚本文件:vim hive.sh

复制代码
    #!/bin/bash
    HIVE_LOG_DIR=$HIVE_HOME/logs
    
    mkdir -p $HIVE_LOG_DIR
    
    #检查进程是否运行正常,参数1为进程名,参数2为进程端口
    function check_process()
    {
    pid=$(ps -ef 2>/dev/null | grep -v grep | grep -i $1 | awk '{print $2}')
    ppid=$(netstat -nltp 2>/dev/null | grep $2 | awk '{print $7}' | cut -d '/' -f 1)
    echo $pid
    [[ "$pid" =~ "$ppid" ]] && [ "$ppid" ] && return 0 || return 1
    }
    
    function hive_start()
    {
    metapid=$(check_process HiveMetastore 9083)
    cmd="nohup hive --service metastore >$HIVE_LOG_DIR/metastore.log 2>&1 &"
    cmd=$

全部评论 (0)

还没有任何评论哟~