sqoop hbase导入并与hive结合

来源:互联网 发布:网络编辑实务课程标准 编辑:程序博客网 时间:2024/05/17 21:55
sqoop语句
以tid为主键,info为列族
Html代码 复制代码 收藏代码
  1. sqoop import --connect jdbc:mysql://ip/taobao_db --username hive --password 123456 --table mysql_table_name --hbase-table hbase_table_name --column-family info --split-by tid 


hbae创建表语句
Sql代码 复制代码 收藏代码
  1. create 'trade','info' 


hive创建表语句
Sql代码 复制代码 收藏代码
  1. CREATE EXTERNAL TABLE hbase_trade( 
  2. tid string, 
  3. dp_id string, 
  4. created string, 
  5. modified string, 
  6. buyer_cod_fee double,)  
  7. STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' 
  8. WITH SERDEPROPERTIES ("hbase.columns.mapping" ="info:dp_id,info:created,info:modified,info:buyer_cod_fee") TBLPROPERTIES("hbase.table.name" ="hbase_table_name"); 

遗留问题
sqoop导入数据至hbase时,split-by字段只能是一个,处理不了多字段联合主键的情况。
原创粉丝点击