mysql和hbase整合_hbase整合

本文介绍了如何在HBase与Hive之间进行数据整合,包括在Hive中创建内部表和外部表映射HBase数据。同时,详细阐述了如何使用Sqoop将MySQL数据导入HBase,以及通过Hive作为中间层将HBase数据导回MySQL的过程。
摘要由CSDN通过智能技术生成

hbase與hive整合

1. hive中有數據 --> 創建hive管理表映射hbase

例如:

1)hive創建內部表

create table course.hbase_score(id int,cname string,score int)

stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'

with serdeproperties("hbase.columns.mapping" = "cf:name,cf:score")

tblproperties("hbase.table.name" = "hbase_score");

2)插入數據

insert overwrite table course.hbase_score select id,cname,score from course.score;

2. habse中有數據 --> 創建hive外部表映射hbase

例如:

CREATE external TABLE course.hbase2hive(id int, name string, score int)

STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'

WITH SERDEPROPERTIES ("hbase.columns.mapping" = ":key,cf:name,cf:score")

TBLPROPERTIES("hbase.table.name" ="hbase_hive_score");

hbase與sqoop整合

1.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值