sqoop1.4.6安装

sqoop1.4.6安装

http://blog.csdn.net/linlinv3/article/details/49589615

 

 sqoop import --connect jdbc:mysql://u13:3306/hive --username hive --password hive --table test --hive-import --hive-overwrite --hive-table testt --fields-terminated-by '\t'

 

Sqoop-1.4.4工具import和export使用详解

http://shiyanjun.cn/archives/624.html

 

sqoop导入数据至hive

http://lookqlp.iteye.com/blog/1666449

使用query导入hive表 
    sqoop import --connect jdbc:postgresql://ip/db_name --username user_name  --query "select ,* from retail_tb_order where \$CONDITIONS"  --hive-import -m 5 --hive-table hive_table_name  (--hive-partition-key partition_name --hive-partition-value partititon_value); 
    注意:$CONDITIONS条件必须有,query子句若用双引号,则$CONDITIONS需要使用\转义,若使用单引号,则不需要转义。

 

从mysql增量导入hive

一通过where条件

sqoop import --connect jdbc:mysql://120.132.117.159:33306/protruly_mall_test --username inputuser --password inputpass --table mall_brand \

--where "DATE_FORMAT(CreatedDtm, '%Y-%m-%d')='2016-12-22'" --hive-import --hive-partition-key inputperiod  --hive-partition-value 2016-12-22 \

--hive-overwrite --hive-table aggregate_data.mall_brand --fields-terminated-by '\t'

 

二通过lastValue

sqoop import --connect jdbc:mysql://120.132.117.159:33306/protruly_mall_test --username inputuser --password inputpass --table mall_brand \

--hive-import --hive-overwrite --hive-table aggregate_data.mall_brand --fields-terminated-by '\t' --hive-partition-key inputperiod  --hive-partition-value 2017-03-16 \

--incremental append --check-column CreatedDtm --last-value '2017-03-15 00:00:01'

 

注意lastValue方式根据sqoop新旧版本不同参数

--incremental lastmodified -check-column (高)

--incremental append --check-column (低)

 

导出数据

 sqoop export --connect jdbc:mysql://192.168.7.22:3306/bigdata_qu?characterEncoding=utf-8  --username inputuser --password inputpass --table fact_aggregate_useractivity --export-dir /user/hive/warehouse/aggregate_data.db/fact_aggregate_useractivity/inputperiod=$partition --input-fields-terminated-by '\001' --input-lines-terminated-by '\n'  --input-fields-terminated-by '\t' --input-null-string '\\N' --input-null-non-string '\\N'  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值