Hive/Impala 整合 HBase

Hive 整合 HBase

Hive

创建Hive外部表关联HBase

CREATE EXTERNAL TABLE h_content_k 
(key string, md5 string, title string, catid string, modelid string, published string, publishedby string, time string, datetime string, status string)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES 
("hbase.columns.mapping" = ":key, d:md5, d:title, d:catid, d:modelid, d:published, d:publishedby, d:time, d:datetime, d:status")
TBLPROPERTIES("hbase.table.name" = "test:content_k"); 

Impala

INVALIDATE METADATA h_content_m

相关查询操作

select * from demo_hive limit 3

select * from demo_hive  where name = 'zhangsan'

select * from demo_hive  where name = 'zhangsan' and age= '19'