?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 亚洲国产精品va在线观看麻豆,偷柏自拍亚洲综合在线,性夜影院爽黄a爽在线看

亚洲精品92内射,午夜福利院在线观看免费 ,亚洲av中文无码乱人伦在线视色,亚洲国产欧美国产综合在线,亚洲国产精品综合久久2007

?div class="header_top">
Java知识分n|?- L学习(fn)从此开始!    
SpringBoot+SpringSecurity+Vue+ElementPlus权限pȝ实战评 震撼发布        

最新Java全栈׃实战评(免费)

springcloud分布式电(sh)商秒杀实战评

IDEA怹Ȁz?/h2>

66套java实战评无套路领?/h2>

锋哥开始收Java学员啦!

Python学习(fn)路线?/h2>

锋哥开始收Java学员啦!
当前位置: 主页 > Java文档 > 大数据云计算 >

Hive数据导入HBase的方? PDF 下蝲


分n刎ͼ
旉:2020-08-22 10:00来源:http://www.sh6999.cn 作?锋  侉|举报
Hive数据导入HBase的方? PDF 下蝲
失效链接处理
Hive数据导入HBase的方?nbsp; PDF 下蝲



本站整理下蝲Q?/span>
链接Q?a target="_blank">https://pan.baidu.com/s/1g0m2oH5EtUaqw2-R9xk4Kw 
提取码:cvqy
 
相关截图Q?/span>
 
主要内容Q?/span>

Ҏ(gu)一QHive兌HBase表方?/div>
适用场景Q数据量不大4T以下Q走hbase的api导入数据Q?/div>
一、hbase表不存在的情?/div>
创徏hive表hive_hbase_table映射hbase表hbase_tableQ会自动创徏hbase表hbase_tableQ且会随着hive表删除而删除,q里需要指定hive的schema到hbase schema的映关p:
1、徏?/div>
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");
 
 
2、创Z张原始的hive表,准备一些数?/div>
create table hive_data (key int,name String,age string);
insert into hive_data values(1,"za","13");
insert into hive_data values(2,"ff","44");
3、把hive原表hive_data的数据,通过hive表hive_hbase_table导入到hbase的表hbase_table?/div>
insert into table hive_hbase_table select * from hive_data;
4、查看hbase表hbase_table中是否有数据
 
二、hbase表存在的情况
创徏hive的外表关联hbase?注意hive schema到hbase schema的映关pR删除外表不会删除对应hbase?/div>
CREATE EXTERNAL TABLE hive_hbase_external_table(key String, name string,sex String,age String,department String) 
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,info:name,info:sex,info:age,info:department") 
TBLPROPERTIES ("hbase.table.name" = "filtertest", 
"hbase.mapred.output.outputtable" = "filtertest");
其他步骤与上面相?/div>
Ҏ(gu)二:Hive表生成hfileQ通过bulkload导入到hbase
1、适用场景Q数据量大(4T以上Q?/div>
2、把hive数据转换为hfile
3、启动hiveq添加相关的hbase的jar?/div>
 
add jar /mnt/hive/lib/hive-hbase-handler-2.1.1.jar;
add jar /mnt/hive/lib/hbase-common-1.1.1.jar;
add jar /mnt/hive/lib/hbase-client-1.1.1.jar;
add jar /mnt/hive/lib/hbase-protocol-1.1.1.jar;
add jar /mnt/hive/lib/hbase-server-1.1.1.jar;
 
4、创Z个outputformat为HiveHFileOutputFormat的hive?/div>
     其中/tmp/hbase_table_hfile/cf_0是hfile保存到hdfs的\径,cf_0是hbase family的名?/div>
create table hbase_hfile_table(key int, name string,age String) 
stored as
INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.hbase.HiveHFileOutputFormat'
TBLPROPERTIES ('hfile.family.path' = '/tmp/hbase_table_hfile/cf_0');
5、原始数据表的数据通过hbase_hfile_table表保存ؓ(f)hfile
insert into table hbase_hfile_table select * from hive_data;
6、查看对应hdfs路径是否生成了hfile

 
 
------分隔U?---------------------------
?!-- //底部模板 -->