我使用的是Hadoop 2.6.5,编写的程序可以生成3个输出文件。
当我运行本地时,程序运行得很好,创建了3个输出文件。当我使用EMR运行它时,这几行崩溃-文件已经存在:O
我知道这不是在EMR中使用Hadoop的方法。
我看过这个帖子:https://forums.aws.amazon.com/thread.jspa?threadID=131036
但是我没有这种方法: mos.getCollector和我没有找到任何关于如何在java中使用EMR进行mos的文档。
这是我的Reducer的代码:
@Override
protected void setup(Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub
mos = new MultipleOutputs<>(context);
}
@Override
protected void cleanup(Reducer<Text, IntWritable, Text, IntWritable>.Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub
mos.close();
}..。reduce方法的结尾-编写结果文件部分(1、2和3)
if (keyArr.length == 1) {
mos.write(key, result, "ones.txt");
}
else if (keyArr.length == 2) {
mos.write(key, result, "twos.txt");
}
else {
mos.write(key, result, "threes.txt");
}发布于 2017-12-12 03:20:54
你能上传异常吗?它看起来像是读/写并发
https://stackoverflow.com/questions/47733586
复制相似问题