hive2_pid=`pgrep -f org.apache.hive.service.server.HiveServer2`
if [[ -n "$hive2_pid" ]]
then
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
fi
echo "Hive server2 stopped successfully"
else
echo "Hiveserver2 process not found , HIveserver2 is not running !!!"
fi
meta_pid=`pgrep -f org.apache.hadoop.hive.metastore.HiveMetaStore`
if [[ -n "$meta_pid" ]]
then
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
fi
echo "Hive metastore stopped successfully"
else
echo "Hive metastore process not found , Hive metastore is not running !!!"
fi
2条答案
按热度按时间ih99xse11#
请参阅此链接:http://www.cloudera.com/documentation/archive/cdh/4-x/4-2-0/cdh4-installation-guide/cdh4ig_topic_18_8.html
eoigrqb62#
编写一个小的shell脚本来查找hiveserver2进程并停止它。我使用了below shell脚本来停止hiveserver2和hive metastore进程。希望这有帮助。