hive的启动

一、通过Hive CLI(command line interface)方式启动

$ bin/hive
15/10/20 15:12:01 INFO Configuration.deprecation: mapred.input.dir.recursive is deprecated. Instead, use mapreduce.input.fileinputformat.input.dir.recursive
......
hive> 

二、通过HiveServer2 and Beeline方式启动

1、先启动HiveServer2

$ bin/hive --service hiveserver2
Starting HiveServer2
15/10/20 15:24:49 INFO Configuration.deprecation: mapred.input.dir.recursive is deprecated. Instead, use mapreduce.input.fileinputformat.input.dir.recursive
......
或者

$ bin/hiveserver2 

这里采用了hive的默认配置,也就是hive.server2.thrift.port为10000,hive.server2.thrift.bind.host为localhost

2、接着就能使用java去连接,也可以使用 HiveServer2的CLI去连接

语法:bin/beeline -u jdbc:hive2://$HS2_HOST:$HS2_PORT

$ bin/beeline -u jdbc:hive2://localhost:10000
scan complete in 3ms
Connecting to jdbc:hive2://localhost:10000
......
Connected to: Hive (version 0.12.0)
Driver: Hive (version 0.12.0)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 0.12.0 by Apache Hive
0: jdbc:hive2://localhost:10000>

连接成功,测试一下:

0: jdbc:hive2://localhost:10000> show databases;
+----------------+
| database_name  |
+----------------+
| default        |
| study          |
| study2         |
+----------------+
3 rows selected (0.458 seconds)


3、 HiveServer的启动类似HiveServer2


三、总结

HiveServer2是 Hive 0.11版本开始有的,HiveServer2是HiveServer的升级版,它们都是以Thrift框架为基础。HiveServer2相对于HiveServer和Hive CLI,HiveServer2增加了新的功能,它支持多客户端的并发和认证,而且为开放API,如JDBC、ODBC提供了更好的支持。所以推荐使用的是HiveServer2。

参考资料

https://cwiki.apache.org/confluence/display/Hive/GettingStarted

https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

succeedloveaaaa

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值