【问题标题】:Hadoop MapReduce wordcount tutorial error: Input path does not existHadoop MapReduce wordcount 教程报错:输入路径不存在
【发布时间】:2016-11-20 00:28:31
【问题描述】:

在我的 Cloudera VM 上运行 Eclipse 中的基本 Hadoop wordcout 教程时出现错误。错误是:

Input path does not exist: file:/user/cloudera/wordcount/input

但是,这个目录确实存在,我专门创建了它,我在我的 HDFS 文件浏览器中盯着它。

Screenshot of my command line query and browser.

我已将您在 eclipse 中看到的命令中的目录复制粘贴到我的运行配置中,这些是我的参数:

/user/cloudera/wordcount/input /user/cloudera/wordcount/output

并且代码本身并没有从我下载的示例中进行修改,相关行是:

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

编辑:

hadoop jar /home/cloudera/examples/wordcount.jar WordCount /user/cloudera/wordcount/input /user/cloudera/wordcount/output

这个命令在终端中工作,但是当我使用参数“/user/cloudera/ wordcount/input /user/cloudera/wordcount/output" 然后我得到上述错误。

为什么 eclipse 不能正确运行这个任务?它可以在终端上运行。

【问题讨论】:

  • 你能显示hadoop命令的执行吗?
  • 你可以参考ybhavesh.blogspot.in上的几个例子
  • file:/user/hdfs:///user/ 不同。这可能就是您的困惑所在。

标签: hadoop mapreduce


【解决方案1】:

为什么 eclipse 不能正常运行这个任务?

我假设您将/user/cloudera/wordcount/input 作为args[0] 提供给Eclipse?

这将创建new Path(args[0]),这是本地 JVM 和文件系统,由URI file:// 指定。

当您将参数提供给hadoop jar 时,它知道它应该从 HDFS 中读取,这是在您的 Hadoop 配置的 XML 文件中指定的,并在 URI hdfs:// 处查找输入。

作为参考,ls -l /hdfs dfs -ls / 相比是非常不同的输出。前者没有指定的路径。

旁注:默认 HDFS 路径使用 file:// Cloudera 快速入门会为您更改此设置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多