停止hiveserver2的正确方法是什么?

3 人关注

我在hadoop 2.6.0的基础上安装了hive 0.14。

设置主要涉及解压tar.bin文件。

I followed this guide to do the setup.

http://www.ishaanguliani.com/content/hive-0140-setup-ubuntu

我用命令行启动hiveserver2。

( $HIVE_HOME/bin/hiveserver2 &> hiveserver.log & )

现在,我想知道停止hiveserver2的正确方法是什么。我可以杀死它,但我怀疑这是否能提供一个优雅的退出。

java
linux
hadoop
hive
redhat
paolov
paolov
发布于 2016-02-17
2 个回答
Aaditya Raj
Aaditya Raj
发布于 2016-02-17
已采纳
0 人赞同

写一个小的shell脚本来找到hiveserver2进程并停止它。我使用下面的shell脚本来停止hiveserver2和hive metastore进程。希望这有帮助。

hive2_pid=`pgrep -f org.apache.hive.service.server.HiveServer2`
    if [[ -n "$hive2_pid" ]]
        echo "Found hivesevrer2 PID-- "$hive2_pid
        kill $hive2_pid
        # if process is still around, use kill -9
        if ps -p $hive2_pid > /dev/null ; then
            echo "Initial kill failed, killing with -9 "
            kill -9 $hive2_pid
    echo "Hive server2 stopped successfully"
        echo "Hiveserver2 process not found , HIveserver2 is not running !!!"
    meta_pid=`pgrep -f org.apache.hadoop.hive.metastore.HiveMetaStore`
    if [[ -n "$meta_pid" ]]
        echo "Found hivesevrer2 PID-- "$meta_pid
        kill $meta_pid
        # if process is still around, use kill -9
        if ps -p $meta_pid > /dev/null ; then
            echo "Initial kill failed, killing with -9 "
            kill -9 $meta_pid
    echo "Hive metastore stopped successfully"
        echo "Hive metastore process not found , Hive metastore is not running !!!"