HBase的业务流程

创建库:
create database 库名;

创建表入库:
create table 表名(
a string,
b string,
c string)
row format delimited
fields terminated by “:” --> 按什么切分
stored as textfile;

导入预处理之后的数据刀原始表中的语句
load data local inpath ‘/opt/user.txt’ into table 表名;
load data local inpath ‘/opt/part-r-00000’ ovewrite into table video_ori;

从原始表查询并插入数据
insert into table 表名 select * from 表名;

数据的分析阶段
hive -e "select * from 库.表名 where 条件 " > /路径/存放文件名.txt

创建外部表的语句
create external table 表名(
a string,
b string,
c string)
row format delimited
fields terminated by “\t” --> 按什么切分
stored as textfile;

将第三部的结果数据加载到外部表中
load data local inpath ‘/路径/存放文件名.txt’ into table 表名;

加载映射表
create table 数据库.映射表名(
videoId string,
a string,
b string,
c string)
stored by ‘org.apache.hadoop.hive.hbase.HBaseStorageHandler’ With serdeproperties(“hbase.columns.mapping”=“cf:a,cf:b,cf:c”)
tblproperties(“hbase.table.name” = “映射表名”);

插入表语句
insert into table 映射表名 select * from 表名;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值