Sqoop自我总结

Sqoop数据导入

 input端output端工具
Sqoop importmysql

hdfs

hive

-m mr数量控制

增量添加时的配置

 

--connect

--username

--password

 

--table

--columns

--where

 

--query 'select * from tablename where 1 =  1 and $CONDITIONS'

 

--target-dir  # 中间文件路径

--delete-target-dir # 删除中间文件路径,不能与增量配置同时使用

--hive-import

--hive-overwrite

--hive-database xxx

--hive-table xxx

--hive-partition-key xxx

--hive-partition-value xxx

--create-hive-table

-m

--split-by xxx

 

--fields-terminated-by 'xx'

--lines-terminated-by 'xx'

 

--check-column xxx

--incremental append/lastmodified

--last-value 'xxxx'1 # 如果xxxx1 是日期 最 xxxx1 < date < 当前日期 的数据 

把导入分为3个阶段

第一阶段:连接mysql 进行数据查询

--table xx
--columns xx
--where xx

--query 'select * from tablename where 1 = 1 and $CONDTIONS' 

第二阶段:输出到hadoop hive hbase

--target-dir #定义中间文件目录
--hive-import
--hive-overwrite
--create-hive-table
--hive-database xxx
--hive-table xxx
--hive-partition-key xxx
--hive-partition-value xxx
--map-column-hive cost="DECIMAL",date="DATE" #指定字段类型映射

第三阶段:输出方式  mr数量 terminated分割 数据插入方式

#mr数量
-m num
--split-by id
#分割符定义
--fields-terminated-by 'xx'
--lines-terimnated-by 'xxx'
#空字符串处理
--input-null-non-string xxx
--input-null-string xxx
--null-non-string xxx
--null-string xxx 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值