折腾了差不多三天,终于从网上找到了相关的解决方案:
问题描述:配置搭建好 Windows + Hadoop + Cygwin 之后,一切运行顺利,就是在调试下面的小 sample 的时候总是报如下错误:
Samples:
[//下面的实例将已解压的 conf 目录拷贝作为输入,查找并显示匹配给定正则表达式的条目。输出写入到指定的output目录。
$ mkdir input
$ cp conf/*.xml input
$ bin/hadoop jar hadoop-*-examples.jar grep input output 'dfs[a-z.]+'
$ cat output/*
]
错误信息:
$ bin/hadoop jar hadoop-0.20.2-examples.jar grep /input/*.xml /output 'dfs[a-z.]+'
12/09/11 14:24:01 INFO mapred.FileInputFormat: Total input paths to process : 5
12/09/11 14:24:02 INFO mapred.JobClient: Running job: job_201209111241_0002
12/09/11 14:24:03 INFO mapred.JobClient: map 0% reduce 0%
12/09/11 14:24:12 INFO mapred.JobClient: Task Id : attempt_201209111241_0002_m_000006_0, Status : FAILED
java.io.FileNotFoundException: File C:/tmp/hadoop-tiky.zheng/mapred/local/taskTracker/jobcache/job_201209111241_0002/attempt_201209111241_0002_m_000006_0/work/tmp does not exist.
at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:361)
at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:245)
at org.apache.hadoop.mapred.TaskRunner.setupWorkDir(TaskRunner.java:519)
at org.apache.hadoop.mapred.Child.main(Child.java:155)
12/09/11 14:24:21 INFO mapred.JobClient: Task Id : attempt_201209111241_0002_m_000006_1, Status : FAILED
java.io.FileNotFoundException: File C:/tmp/hadoop-tiky.zheng/mapred/local/taskTracker/jobcache/job_201209111241_0002/attempt_201209111241_0002_m_000006_1/work/tmp does not exist.
at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:361)
at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:245)
at org.apache.hadoop.mapred.TaskRunner.setupWorkDir(TaskRunner.java:519)
at org.apache.hadoop.mapred.Child.main(Child.java:155)
最后找到答案:
需要在mapred-site.xml中添加暂存目录:
<name>mapred.child.tmp</name>
<value>/home/hadoop-0.20.1/temp</value>
加完,搞定!