打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Hive HBase Integration 集成

官方文档:https://cwiki.apache.org/confluence/display/Hive/HBaseIntegration

 

1、在hive/lib目录下找到hive-hbase-handler-1.2.1.jar,并把该文件拷贝到hbase/lib目录下。

2、把hbase/lib目录下的所有*.jar文件拷贝到hive/lib目录下。

3、在hive的配置文件中 hive-site.xml 增加zookeeper的配置集群信息。

1 <property>2         <name>hbase.zookeeper.quorum</name>3         <value>node1,node2,node3</value>4 </property>

4、在hive中创建临时表:

1 CREATE TABLE t_test1 2 (id int,name string, age string)  3 STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'  4 WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,info:name,info:age")  5 TBLPROPERTIES ("hbase.table.name" = "t_test1","hbase.mapred.output.outputtable" = "t_test1");

HBase表信息:

hbase(main):011:0> describe "t_test1"

测试在hive中插入数据:

hive> insert into t_test1(id,name,age)values(001, 'zs', 'male');

在hbase中同样能查到:

hbase(main):013:0> scan 't_test1'
ROW COLUMN+CELL
1 column=info:age, timestamp=1467337507821, value=male
1 column=info:name, timestamp=1467337507821, value=zs
1 row(s) in 0.3310 seconds

在hbase中插入数据:

hbase(main):015:0> put 't_test1','002','info:age','30'
0 row(s) in 0.0430 seconds

在hive中同样能查到:

hive> select *From t_test1;
OK
2 NULL 30
1 zs male
Time taken: 0.312 seconds, Fetched: 2 row(s)

关联已经存在的hbase表,需要使用external外部表;

应用场景主要针对已经清洗过的数据,放到hbase中,然后通过hql语句根据业务要求将需要的数据提取出来,然后通过sqoop抽取到类似于mysql的数据库中,供展现使用。

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
[一起学Hive]之十三
Hive总结(七)Hive四种数据导入方式
HBase 深入浅出 – IBM Developer
Hbase shell 常用命令(1)
HBase Filter 过滤器之QualifierFilter详解
HBase scan shell操作详解
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服