hadoop - 在集群上运行mapreduce程序时,输入路径被视为输出路径

标签 hadoop mapreduce

当我在集群上运行map-reduce程序时,输入路径被认为是输出路径,所以我总是得到关于

的错误

output directory already exists.

但是当我忽略 DriverClass 的参数时,程序运行成功。 我真的不知道为什么会这样。我可以在 IntelliJ IDEA 中运行这个程序,我在本地环境中得到了正确的答案。

我没有弄错输入路径的索引和输出的

FileInputFormat.setInputPaths(job,new Path(args[0]));
FileOutputFormat.setOutputPath(job,new Path(args[1]));

HDFS结构

enter image description here

下面是我的 hadoop 命令和错误消息

enter image description here

但是,在我忽略 DriverClass 参数后,程序运行成功

enter image description here

最佳答案

您的问题在于:

FileInputFormat.setInputPaths(job,new Path(args[0]));
FileOutputFormat.setOutputPath(job,new Path(args[1]));

args[0] 实际上是类名,所以你想使用 args[1] 作为输入,args[2] 用于输出。

关于hadoop - 在集群上运行mapreduce程序时,输入路径被视为输出路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56513236/

相关文章:

hadoop - 从虚拟集群转发Apache Hue端口?

hadoop - 从具有不同架构的select语句插入Hive表

java - hadoop wordcount示例java.lang.NoClassDefFoundError:hdfs错误

debugging - Hadoop分布式调试脚本不能与Hadoop 2一起使用

java - 如何在Java中按行号搜索文本文件?

java - 为什么将 Mapper 和 Reducer 类声明为静态的?

hadoop - 字符串连接在 pig 中不起作用

hadoop - 多个插入覆盖到多个表查询在所有临时表中存储相同的结果

hadoop - 如何开始学习hadoop

javascript - 如何在 MapReduce 中使用变量?