hive整合hbase

 

1.启动hiveserver2,apache

beeline>!connect jdbc:hive2://localhost:10000,默认用户名为当前用户名app

2.创建关系表oop

create table t_student(id int ,name string) stored by 
'org.apache.hadoop.hive.hbase.HBaseStorageHandler' with
serdeproperties("hbase.columns.mapping"=":key,st1:name")
tblproperties("hbase.table.name"="t_student","hbase.mapred.output.outputtable" = "t_student");spa

###"hbase.mapred.output.outputtable" = "t_student"这个能够不要,表数据就存储在"hbase.table.name"="t_student"表中了) 。server

建立外部表:
create external table t_student_info(id int,age int,sex string) stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' with serdeproperties("hbase.columns.mapping"=":key,st1:age,st2:sex") tblproperties("hbase.table.name"="t_student_info");
 hadoop

关联查询(经过mr处理时间较久)string

hive>select * from t_student t join t_student_info ti where t.id=ti.id;it

相关文章
相关标签/搜索