前提先要启动hiveserver2,不启动怎么连接呢.

 hive --service hiveserver2 &

方式1

先登录beeline,进入beeline的命令行环境,然后连接

[root@mypc01 conf]# beeline
beeline> !connect jdbc:hive2://192.168.xx.101:10000
Connecting to jdbc:hive2://192.168.xx.101:10000
Enter username for jdbc:hive2://192.168.xx.101:10000: root
Enter password for jdbc:hive2://192.168.xx.101:10000: ******
Connected to: Apache Hive (version 1.1.0-cdh5.13.2)
Driver: Hive JDBC (version 1.1.0-cdh5.13.2)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://192.168.xx.101:10000> show databases;
INFO  : Compiling command(queryId=root_20210103143131_e7b2263c-06d3-4824-b602-c46f599f7978): show databases;
+----------------+--+
| database_name  |
+----------------+--+
| default        |
+----------------+--+

方式二

一步到位

beeline -u jdbc:hive2://192.168.xx.101:10000 -n root

总结

  • 首先要启动hiveserver2
  • beeline连接hive有两种方式,第二种简单些
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐