sqoop将mysql数据导入hbase_使用sqoop将mysql的数据导入到HBase中

使用hbase shell创建好表:create  "tobacco_price","info"。如果在sqoop导入语句中使用--hbase-create-table创建表,会报错。

使用sqoop将mysql的数据导入到hbase中(自己指定列的情形)

./sqoop import --connect "jdbc:mysql://192.168.127.12/asto_ec_origin?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true" --username root --password 123456 --table datag_tobacco_price_list --columns "id,area_code,name,brand,wholesale_price,retail_price,producer_name,gmt_created,gmt_modified" --hbase-table tobacco_price --column-family info --hbase-row-key id -m 1

(默认列名)

./sqoop import --connect "jdbc:mysql://192.168.127.12/asto_ec_origin?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true" --username root --password 123456 --table datag_tobacco_price_list --hbase-table tobacco_price2 --column-family info --hbase-row-key id -m 1

如果rowkey需要两个字段的组合,可以用逗号分隔,如:

--hbase-row-key id,area_code

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值