您的位置:首页 > 运维架构

sqoop 初用

2015-10-29 14:31 295 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: