攻城狮科学家

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

http://blog.csdn.net/dbanote/article/details/8907650

 

目前版本的Sqoop中,使用自由形式查询导入,只提供简单的查询,没有复杂的和“OR”条件查询在where子句中。

http://blog.csdn.net/niityzu/article/details/42835273

 

sqoop list-databases --connect jdbc:mysql://ip:3306/ --username * --password *

sqoop import --connect jdbc:mysql://ip:3306/gwr --username * --password * --table * -m 1

sqoop import --connect jdbc:mysql://ip:3306/gwr --username * --password g* --split-by Period -e 'select s.*, a.UtilityAccountID from AccountStats s, Account a where a.AccountID=s.AccountID and $CONDITIONS' --target-dir /data -m 2

m 表示mapreduce进程数

 

Afilter = FILTER A by (StatsType MATCHES '.*EON_SH.heatinghours.*' or StatsType MATCHES '.*....*');

 

从hdfs导出到数据库

sqoop export --connect jdbc:mysql://ip:3306/gwr --username * --password g* --table AccountStatsAggregate --fields-terminated-by '\t' --export-dir '/user/hduser/heatinghours'

要保证路径里的文本格式和数据库设定的一致才能导入

 

export 到MySQL中,增量覆盖:

http://hadooped.blogspot.sg/2013/06/apache-sqoop-part-3-data-transfer.html

 

posted on 2015-10-29 14:31  攻城狮科学家  阅读(136)  评论(0编辑  收藏  举报