Hive 数据导入 Hbase
方案一:Hive 关联 HBase 表方式
适用场景:数据量不大 4T 以下(走 hbase 的 api 导入数据)
一、hbase 表不存在的情况
创建 hive 表 hive_hbase_table 映射 hbase 表 hbase_table,会自动创
建 hbase 表 hbase_table,且会随着 hive 表删除而删除,这里需要指定 hive
的 schema 到 hbase schema 的映射关系:
1、建表
CREATE TABLE hive_hbase_table(key int, name String,age
String)
STORED BY
'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" =
":key,cf1:name,cf1:age")
TBLPROPERTIES ("hbase.table.name" = "hbase_table",
"hbase.mapred.output.outputtable" = "hbase_table");
评论0
最新资源