eclipse Hadoop - 输入路径不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16034339/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:22:40  来源:igfitidea点击:

Hadoop - Input path does not exist

eclipseubuntuhadoopmapreduce

提问by Jeevanantham

I did set up the hadoop Ubuntu OS, followed all the necessary steps, 1.created the hdfs file system 2.Moved the text files to input directory 3.having privilege to access all the directories. but when run the simple word count example, i got

我确实设置了 hadoop Ubuntu 操作系统,遵循了所有必要的步骤,1.创建了 hdfs 文件系统 2.将文本文件移动到输入目录 3.具有访问所有目录的权限。但是当运行简单的字数统计示例时,我得到了

Exception in thread "main" org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: file:/user/root/input
at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.listStatus(FileInputFormat.java:224)

but, input path is valid and even can able view the files in that path from eclipse itself, so plz assist were i am wrong.

但是,输入路径是有效的,甚至可以从 eclipse 本身查看该路径中的文件,所以请帮助我错了。

attached the screenshot for the reference enter image description here

附上截图供参考 在此处输入图片说明

回答by Tariq

Add the following 2 lines in your code :

在您的代码中添加以下 2 行:

config.addResource(new Path("/HADOOP_HOME/conf/core-site.xml"));
config.addResource(new Path("/HADOOP_HOME/conf/hdfs-site.xml"));

Your client is looking into the local FS.

您的客户正在调查本地 FS。

回答by Rajesh Goel

For hadoop-2.2.0 on windows 7, I added the below lines and it solved the issue (NOTE: My Hadoop Home is: C:\MyWork\MyProjects\Hadoop\hadoop-2.2.0)

对于 windows 7 上的 hadoop-2.2.0,我添加了以下几行并解决了问题(注意:我的 Hadoop 主页是:C:\MyWork\MyProjects\Hadoop\hadoop-2.2.0)

Configuration conf = new Configuration();

配置 conf = 新配置();

conf.addResource(new Path("C:\MyWork\MyProjects\Hadoop\hadoop-2.2.0\etc\hadoop\core-site.xml"));

conf.addResource(new Path("C:\MyWork\MyProjects\Hadoop\hadoop-2.2.0\etc\hadoop\core-site.xml"));

conf.addResource(new Path("C:\MyWork\MyProjects\Hadoop\hadoop-2.2.0\etc\hadoop\hdfs-site.xml"));

conf.addResource(new Path("C:\MyWork\MyProjects\Hadoop\hadoop-2.2.0\etc\hadoop\hdfs-site.xml"));