以tid爲主鍵,info爲列族
- 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
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創建表語句
- create 'trade','info'
create 'trade','info'
hive創建表語句
- CREATE EXTERNAL TABLE hbase_trade(
- tid string,
- dp_id string,
- created string,
- modified string,
- buyer_cod_fee double,)
- STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
- WITH SERDEPROPERTIES ("hbase.columns.mapping" = "info:dp_id,info:created,info:modified,info:buyer_cod_fee") TBLPROPERTIES("hbase.table.name" = "hbase_table_name");
CREATE EXTERNAL TABLE hbase_trade(
tid string,
dp_id string,
created string,
modified string,
buyer_cod_fee double,)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
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字段只能是一個,處理不了多字段聯合主鍵的情況。