Sqoop导入数据到mysql数据库报错:ERROR tool.ExportTool: Error during export: Export job failed!

发布时间:2022-07-03 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Sqoop导入数据到mysql数据库报错:ERROR tool.ExportTool: Error during export: Export job failed!脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

问题描述:

Container killed by the ApplicationMaster.
Container killed on request. ExIT code is 143
Container exited with a non-zero exit code 143

21/10/10 08:51:52 INFO mapreduce.Job:  map 100% reduce 0%
21/10/10 08:51:53 INFO maPReduce.Job: Job job_1633826412371_0001 failed with state FAILED due to: Task failed task_1633826412371_0001_m_000000
Job failed as tasks failed. failedMaps:1 failedReduces:0

21/10/10 08:51:54 INFO mapreduce.Job: Counters: 9
    Job Counters 
        Failed map tasks=4
        Launched map tasks=4
        Other local map tasks=3
        Data-local map tasks=1
        total time sPEnt by all maps in occupied slots (ms)=52317
        Total time spent by all reduces in occupied slots (ms)=0
        Total time spent by all map tasks (ms)=52317
        Total vcore-milliseconds taken by all map tasks=52317
        Total megabyte-milliseconds taken by all map tasks=53572608
21/10/10 08:51:54 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
21/10/10 08:51:54 INFO mapreduce.exportJobBase: transferred 0 bytes in 110.2385 seconds (0 bytes/sec)
21/10/10 08:51:54 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
21/10/10 08:51:54 INFO mapreduce.ExportJobBase: Exported 0 records.
21/10/10 08:51:54 ERROR tool.ExportTool: Error during export: Export job failed!

解决方案

①首先查看hive中的表结构是否MySQL一致。(desc 表名称)

Sqoop导入数据到mysql数据库报错:ERROR tool.ExportTool: Error during export: Export job failed!

 

 

 如果表结构一致的话可能就是mySQL表的字符集不一致导致

②Sqoop导入数据到mysql数据库命令

bin/sqoop export 
> --connect “jdbc:mysql://master:3306/mysql?useUnicode=true&characterEncoding=utf-8
> --username root 
> --password 000000 
> --table QX_DIYu_results 
> --num-mappers 1 
> --export-dir /user/hive/warehouse/diyu_resaults 
> --input-fields-terminated-by ","

从命令中可以看出我使用的编码为utf8,所以应将mysql中表的字符集修改为utf8

Sqoop导入数据到mysql数据库报错:ERROR tool.ExportTool: Error during export: Export job failed!

 

 

 修改完成之后再次运行命令,出现如下结果表示数据导入成功:

Sqoop导入数据到mysql数据库报错:ERROR tool.ExportTool: Error during export: Export job failed!

 

脚本宝典总结

以上是脚本宝典为你收集整理的Sqoop导入数据到mysql数据库报错:ERROR tool.ExportTool: Error during export: Export job failed!全部内容,希望文章能够帮你解决Sqoop导入数据到mysql数据库报错:ERROR tool.ExportTool: Error during export: Export job failed!所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。