java Hadoop 要求输入路径位于 localhost 9000
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15732597/
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
Hadoop is asking for the input path to be on localhost 9000
提问by Bohn
I am trying to run the Tom Whites' Chapter 2 example
我正在尝试运行 Tom Whites 的第 2 章示例
When I run the command:
当我运行命令时:
hadoop MaxTemperature input/ncdc/sample.txt output
The error I am getting is this:
我得到的错误是这样的:
11/12/31 18:08:28 INFO mapred.JobClient: Cleaning up the staging area hdfs://localhost:9000/tmp/hadoop-mymac/mapred/staging/mymac/.staging/job_201112311807_0001
11/12/31 18:08:28 ERROR security.UserGroupInformation: PriviledgedActionException as:mymac (auth:SIMPLE) cause:org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: hdfs://localhost:9000/user/mymac/input/ncdc/sample.txt
Exception in thread "main" org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: hdfs://localhost:9000/user/mymac/input/ncdc/sample.txt
What is it that I have set wrong?
是什么我设置错了?
I haven't touched his source code, it can be found in here:
我没有接触过他的源代码,可以在这里找到:
回答by Philippe Signoret
Your core-site.xml
and hdfs-site.xml
files are configured to use localhost:9000
. If this isn't what you expect (which is what I get from you post's title), what didyou expect?
您的core-site.xml
和hdfs-site.xml
文件被配置为使用localhost:9000
. 如果这不是你所期望的(这是我从您发布的标题),什么没有你期待什么?
What version of Hadoop are we talking about? How did you install your Hadoop distribution? From your other question and the config files, I'm guessing you used CHD4. If you look over the instructions from Cloudera, can you see if you missed anything?
我们在谈论什么版本的 Hadoop?您是如何安装 Hadoop 发行版的?根据您的其他问题和配置文件,我猜您使用的是 CHD4。如果您查看Cloudera 的说明,您是否可以看到是否遗漏了什么?
Before starting Hadoop, did you format HDFS?
在开始Hadoop之前,你格式化过HDFS吗?
$ hadoop namenode -format
Then, after starting Hadoop, do you get anything other than INFO messages?
那么,启动Hadoop之后,除了INFO消息之外,你还有什么信息吗?
Did you copy the input data into HDFS?
您是否将输入数据复制到 HDFS 中?
$ hadoop dfs -put /tmp/my/input/data input
Finally, what do you get from simple HDFS commands such as:
最后,你从简单的 HDFS 命令中得到了什么,例如:
$ hadoop dfs -ls /
UPDATE: Run Word Count
更新:运行字数统计
- Get HDFS up and running. Running
hadoop dfs -ls /
should work. - Copy a folder with text file(s) into HDFS:
hadoop dfs -put text_files input_folder
- Run
hadoop dfs -ls .
to see if your files got copied correctly. - Find the
hadoop-examples-X.Y.Z.jar
file on your system. Navigate to whatever directory it's in, and run:
$ hadoop jar hadoop-examples-*.jar WordCount input_folder output_folder
.You should see the progress of the MapReduce application.
- When its finished, view the output with
hadoop dfs -cat output_folder/*
.
- 启动并运行 HDFS。跑步
hadoop dfs -ls /
应该有效。 - 将包含文本文件的文件夹复制到 HDFS:
hadoop dfs -put text_files input_folder
- 运行
hadoop dfs -ls .
以查看您的文件是否被正确复制。 hadoop-examples-X.Y.Z.jar
在您的系统上找到该文件。导航到它所在的任何目录,然后运行:
$ hadoop jar hadoop-examples-*.jar WordCount input_folder output_folder
.您应该会看到 MapReduce 应用程序的进度。
- 完成后,查看输出
hadoop dfs -cat output_folder/*
。
回答by user1900344
Forgot to set JAVA_HOME
in etc/hadoop/hadoop-env.sh
may also cause this error
忘了把JAVA_HOME
中etc/hadoop/hadoop-env.sh
可能也导致此错误