使用sqoop将数据从HDFS导出到MYSQL

时间:2018-04-21 15:06:57

标签: mysql hadoop hdfs sqoop

我正在尝试将数据从HDFS导出到MySQL。我尝试下面的代码,它抛出错误,但我在MySQL表中执行select *查询时,我能够看到115条记录中的56条记录。以下是我的代码:

sqoop export \
--connect jdbc:mysql://localhost/sampleOne \
--username root \
--password root \
--table SAMPLEDATA \
-m 2 \
--export-dir /sampleData.csv \
--update-mode allowinsert  

最后update-mode行的存在与否没有任何区别。

错误味精:

18/04/21 20:23:22 INFO mapreduce.Job: Counters: 9
    Job Counters 
        Failed map tasks=1
        Killed map tasks=1
        Launched map tasks=2
        Data-local map tasks=2
        Total time spent by all maps in occupied slots (ms)=13910
        Total time spent by all reduces in occupied slots (ms)=0
        Total time spent by all map tasks (ms)=13910
        Total vcore-milliseconds taken by all map tasks=13910
        Total megabyte-milliseconds taken by all map tasks=14243840
18/04/21 20:23:22 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
18/04/21 20:23:22 INFO mapreduce.ExportJobBase: Transferred 0 bytes in 23.5885 seconds (0 bytes/sec)
18/04/21 20:23:22 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
18/04/21 20:23:22 INFO mapreduce.ExportJobBase: Exported 0 records.
18/04/21 20:23:22 ERROR mapreduce.ExportJobBase: Export job failed!
18/04/21 20:23:22 ERROR tool.ExportTool: Error during export: 
Export job failed!
    at org.apache.sqoop.mapreduce.ExportJobBase.runExport(ExportJobBase.java:445)
    at org.apache.sqoop.manager.SqlManager.exportTable(SqlManager.java:931)
    at org.apache.sqoop.tool.ExportTool.exportTable(ExportTool.java:80)
    at org.apache.sqoop.tool.ExportTool.run(ExportTool.java:99)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
    at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
    at org.apache.sqoop.Sqoop.main(Sqoop.java:252)  

谁能解释一下我哪里出错?提前致谢

0 个答案:

没有答案