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