1 hiveserver2启动脚本
我的hiveserver2启动脚本仅供参考:
#!/bin/bash
echo "=========================开启metastore========================="
nohup hive --service metastore >/opt/module/logs/hive/ 2>&1 &
sleep 10s
echo "=========================开启hiveserver2========================="
hive --service hiveserver2 >/opt/module/logs/hive/ 2>&1 &
sleep 15s
netstat -ltpn | grep 9083
netstat -ltpn | grep 10000
echo "=========================开启beeline========================="
beeline -u jdbc:hive2://cts111:10000 -n rocky
2 启动后使用jps
命令查看:
[rocky@cts111 hive]$ jps
90001 Jps
67746 Bootstrap
89796 RunJar
66006 NameNode
89577 RunJar
67400 ResourceManager
67611 NodeManager
67692 ApplicationHistoryServer
89676 RunJar
66302 DataNode
其中的两个RunJar
就是启动的metastore
和hiveserver2
。
3 停止hiveserver2 运行可以使用命令:
[rocky@cts111 hive]$ kill -9 89796
[rocky@cts111 hive]$ kill -9 89577
再使用jps查看它们是否被kill掉,或者使用下面命令查看:
[rocky@cts111 hive]$ netstat -ltpn | grep 10000
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
[rocky@cts111 hive]$ netstat -ltpn | grep 9083
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
未被kill掉的情况:
[rocky@cts111 hive]$ netstat -ltpn | grep 9083
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:9083 0.0.0.0:* LISTEN 89577/java
[rocky@cts111 hive]$ netstat -ltpn | grep 10000
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 89676/java
4 hiveserver2更优雅的停止方式
还没发现hiveserver2除了使用kill命令外其他更优雅的停止方式。。。
5 参考文章
1)hive的HiveServer2/beeline配置及使用
2)hive beeline 的server启动与连接
3)hiveserver2 后台运行
4)启动hiveserve2
5)启动和停止hiveserver2