美文网首页数据蛙数据分析每周作业
ERROR tool.ImportTool: Import fa

ERROR tool.ImportTool: Import fa

作者: 我住永安当 | 来源:发表于2020-11-14 01:08 被阅读0次

    报错代码:

    20/11/14 00:36:50 ERROR tool.ImportTool: Import failed: org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:9000/user/frog005/course already exists
    at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:146)
    at org.apache.hadoop.mapreduce.JobSubmitter.checkSpecs(JobSubmitter.java:279)
    at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:145)
    at org.apache.hadoop.mapreduce.Job11.run(Job.java:1570) at org.apache.hadoop.mapreduce.Job11.run(Job.java:1567)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1889)
    at org.apache.hadoop.mapreduce.Job.submit(Job.java:1567)
    at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:1588)
    at org.apache.sqoop.mapreduce.ImportJobBase.doSubmitJob(ImportJobBase.java:200)
    at org.apache.sqoop.mapreduce.ImportJobBase.runJob(ImportJobBase.java:173)
    at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:270)
    at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:692)
    at org.apache.sqoop.manager.MySQLManager.importTable(MySQLManager.java:127)
    at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:520)
    at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:628)
    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)

    发生场景:
    在使用sqoop命令向hive中的Lee库导入数据表(course)和数据后,drop掉course表。重新使用完全相同的sqoop命令重新导入数据表和数据。

    20/11/14 00:36:50 ERROR tool.ImportTool: Import failed: org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:9000/user/frog005/course already exists

    解决方案:
    这是因为每次MR都会生成一个output目录但是不能自动删除,所以我们就把HDFS的输出目录删除:

    • step 1
    hadoop fs -ls -r hdfs://localhost:9000/user/frog005/
    hadoop fs -rm -r hdfs://localhost:9000/user/frog005/course
    
    hadoop查看hdfs输出目录
    hadoop删除hdfs输出目录 image.png
    • step 2
      重新运行sqoop import命令即可。
    sqoop import \
    --hive-import \
    --connect jdbc:mysql://106.xx.xxx.xxx:xxx/datafrog05_adventure \
    --table course \
    --username xxxx05 \
    --password xxx'!'xxx \
    --hive-database Lee \
    --hive-overwrite \
    --m 1
    
    image.png

    相关文章

      网友评论

        本文标题:ERROR tool.ImportTool: Import fa

        本文链接:https://www.haomeiwen.com/subject/swribktx.html