我试图找出 Map 任务的输出在被 Reduce 任务使用之前保存到磁盘的位置。
注意: - 使用的版本是带有新 API 的 Hadoop 0.20.204
例如,在 Map 类中覆盖 map 方法时:
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String line = value.toString();
StringTokenizer tokenizer = new StringTokenizer(line);
while (tokenizer.hasMoreTokens()) {
word.set(tokenizer.nextToken());
context.write(word, one);
}
// code that starts a new Job.
}
我很想知道 context.write() 最终在哪里写入数据。到目前为止,我遇到了:
FileOutputFormat.getWorkOutputPath(context);
这给了我在 hdfs 上的以下位置:
hdfs://localhost:9000/tmp/outputs/1/_temporary/_attempt_201112221334_0001_m_000000_0
当我尝试将其用作另一项工作的输入时,它给了我以下错误:
org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: hdfs://localhost:9000/tmp/outputs/1/_temporary/_attempt_201112221334_0001_m_000000_0
注意:该作业是在 Mapper 中启动的,因此从技术上讲,当新作业开始时,Mapper 任务正在写入其输出的临时文件夹就存在。话又说回来,它仍然说输入路径不存在。
关于临时输出的写入位置有什么想法吗?或者,在同时具有 Map 和 Reduce 阶段的作业期间,我可以在哪里找到 Map 任务的输出?