HiveJDBC访问——hiveserver2和beeline启动和关闭

HiveJDBC访问——hiveserver2和beeline启动和关闭

一、步骤:

1.先在一个会话中启动hiveserver2服务

[LORENZO@hadoop102 hive]$ bin/hiveserver2

2.再在另一个会话中启动beeline

[LORENZO@hadoop1 hive]$ bin/beeline
Beeline version 1.2.1 by Apache Hive
beeline> !connect jdbc:hive2://hadoop102:10000
Connecting to jdbc:hive2://hadoop102:10000
Enter username for jdbc:hive2://hadoop102:10000: Glorenzo
Enter password for jdbc:hive2://hadoop102:10000: 
Connected to: Apache Hive (version 1.2.1)
Driver: Hive JDBC (version 1.2.1)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://hadoop102:10000> show databases;
+----------------+--+
| database_name  |
+----------------+--+
| default        |
| hive_db2       |
+----------------+--+

3.先关闭beeline

0: jdbc:hive2://hadoop102:10000> !quit

4.再关闭hiveserver2

[LORENZO@hadoop102 hive]$ jps
14485 RunJar
3126 NodeManager
3340 DataNode
3228 NameNode
17500 Jps
[LORENZO@hadoop102 hive]$ kill -9 14485

二、hiveserver2后台运行

[LORENZO@hadoop102 hive]$ nohup bin/hiveserver2 > s2.log 2>&1 &

这个&1也指的是s2.log,意思是启动后,运行时的标准输出和错误输出都写到s2.log里面

你可能感兴趣的:(Hive)