简体   繁体   English

Hadoop要求输入路径在localhost 9000上

[英]Hadoop is asking for the input path to be on localhost 9000

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: 我没有触及他的源代码,可以在这里找到:

https://github.com/tomwhite/hadoop-book/tree/3e/ch02 https://github.com/tomwhite/hadoop-book/tree/3e/ch02

Your core-site.xml and hdfs-site.xml files are configured to use localhost:9000 . 您的core-site.xmlhdfs-site.xml文件配置为使用localhost:9000 If this isn't what you expect (which is what I get from you post's title), what did you expect? 如果这不是你所期望的(这是我从你文章的标题得到),有什么办法

What version of Hadoop are we talking about? 我们在谈论什么版本的Hadoop? How did you install your Hadoop distribution? 您是如何安装Hadoop发行版的? From your other question and the config files, I'm guessing you used CHD4. 从你的其他问题和配置文件,我猜你用过CHD4。 If you look over the instructions from Cloudera , can you see if you missed anything? 如果你查看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 更新:运行字数

  1. Get HDFS up and running. 启动并运行HDFS。 Running hadoop dfs -ls / should work. 运行hadoop dfs -ls /应该可以工作。
  2. Copy a folder with text file(s) into HDFS: hadoop dfs -put text_files input_folder 将包含文本文件的文件夹复制到HDFS: hadoop dfs -put text_files input_folder
  3. Run hadoop dfs -ls . 运行hadoop dfs -ls . to see if your files got copied correctly. 查看您的文件是否被正确复制。
  4. Find the hadoop-examples-XYZjar file on your system. 在您的系统上找到hadoop-examples-XYZjar文件。
  5. Navigate to whatever directory it's in, and run: 导航到它所在的目录,然后运行:

    $ hadoop jar hadoop-examples-*.jar WordCount input_folder output_folder . $ hadoop jar hadoop-examples-*.jar WordCount input_folder output_folder

  6. You should see the progress of the MapReduce application. 您应该看到MapReduce应用程序的进度。

  7. When its finished, view the output with hadoop dfs -cat output_folder/* . 完成后,使用hadoop dfs -cat output_folder/*查看输出。

忘了在etc/hadoop/hadoop-env.sh设置JAVA_HOME也可能导致此错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM