使用sqoop1.3
正在尝试将hdfs输出导出到mysql表
加载大小超过300mb的未压缩文件时,一切正常
但是,在加载大小为75MB或79MB的压缩文件(.gz和.lzo)时,我看到表中加载了两倍的行。当压缩文件的大小小于或等于60mb时,不会发生这种情况(猜测与64MB、块大小有关的内容)。我在上述情况下所做的一些操作:
bash-3.2$ ls -ltr
-rw-r--r-- 1 bhargavn bhargavn 354844413 Nov 16 02:27 large_file
-rw-rw-r-- 1 bhargavn bhargavn 15669507 Nov 21 03:41 small_file.lzo
-rw-rw-r-- 1 bhargavn bhargavn 75173037 Nov 21 03:46 large_file.lzo
bash-3.2$ wc -l large_file
247060 large_file
bash-3.2$ sqoop export --connect 'jdbc:mysql://db.com/test?zeroDateTimeBehavior=round& rewriteBatchedStatements=true'
--table table_with_large_data
--username sqoopuser
--password sqoop
--export-dir /user/bhargavn/workspace/data/sqoop-test/large_file.lzo
--fields-terminated-by '\001' -m 1
[21/11/2012:05:52:28 PST] main INFO org.apache.hadoop.mapred.JobClient: map 0% reduce 0%
[21/11/2012:05:57:03 PST] main INFO com.cloudera.sqoop.mapreduce.ExportJobBase: Transferred 143.3814 MB in 312.2832 seconds (470.1584 KB/sec)
[21/11/2012:05:57:03 PST] main INFO com.cloudera.sqoop.mapreduce.ExportJobBase: Exported 494120 records.
mysql> select count(1) from table_with_large_data;
+----------+
| count(1) |
+----------+
| 494120 |
+----------+
mysql> truncate table_with_large_data;
bash-3.2$ sqoop export --connect 'jdbc:mysql://db.com/test?zeroDateTimeBehavior=round& rewriteBatchedStatements=true'
--table table_with_large_data
--uername sqoopuser
--password sqoop
--export-dir /user/bhargavn/workspace/data/sqoop-test/large_file
--fields-terminated-by '\001'
-m 1
[21/11/2012:06:05:35 PST] main INFO org.apache.hadoop.mapred.JobClient: map 0% reduce 0%
[21/11/2012:06:08:06 PST] main INFO org.apache.hadoop.mapred.JobClient: map 100% reduce 0%
[21/11/2012:06:08:06 PST] main INFO com.cloudera.sqoop.mapreduce.ExportJobBase: Transferred 338.4573 MB in 162.5891 seconds (2.0817 MB/sec)
[21/11/2012:06:08:06 PST] main INFO com.cloudera.sqoop.mapreduce.ExportJobBase: Exported 247060 records.
mysql> select count(1) from table_with_large_data;
+----------+
| count(1) |
+----------+
| 247060 |
+----------+
1条答案
按热度按时间wgxvkvu91#
您可能遇到了一个sqoop需要修复的已知错误[1]。
您介意在sqoop用户邮件列表[2]上签名并在那里描述您的问题吗?我非常有信心,sqoop开发人员将参与解决这个特定问题。
贾尔切克
链接:
1: https://issues.apache.org/jira/browse/sqoop-721
2: http://sqoop.apache.org/mail-lists.html