向表里插入数据
put '表名' ,'rowkey名' ,'列簇名:列名','列值'
查表
scan '表名'
rowkey 条件查询 过滤查询
scan '表名' ,{FILTER=>"PrefixFilter('所需字段')"}
hbase 、hive 集成
create table t_record(id string,shopsn string,prodid string, score string) stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' with serdeproperties("hbase.columns.mapping"=":key,cf1:shopsn,cf1:prodid,cf1:score") tblproperties("hbase.table.name"="t_record","hbase.mapred.output.outputtable" = "t_record");
表名为t_record
列簇 cf1
列名 score,prodid,shopsn
Hive 建表
create table advhive (materialId string ,onlyRemark string,userId string,positionId string,recordTime string,storetime string) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE ;
上面见表 是为了hdfs导入hive 以tab键 间隔。
第一种方式
load data inpath '/user/warehouse/test_hive' into table advhive ;
CREATE EXTERNAL TABLE score_matrix(buscode string , userid string, shopsn string, prodid string , score string)
COMMENT 'Records of consumption'
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE
LOCATION '/user/hive/warehouse/score_matrix';
第二种方式
MR输出路径指向 /user/hive/warehouse/score_matrix
select * from advhive ;
2018年5月28日17:49:12
sqoop 安装教程
https://blog.csdn.net/qy20115549/article/details/53981290
CDH各版本下载地址
http://archive.cloudera.com/cdh5/cdh/5/