マッパーから直接 Hadoop ファイル システムにプレーン テキスト ファイルを書き込もうとしています。
私は次のようにします:
public void createFile(Configuration conf) throws IOException{
FileSystem fs = FileSystem.get(conf);
Path filenamePath = new Path(conf.get("mapred.output.dir")+"/_"+conf.get("mapred.task.id"), "tree.txt");
try {
if (fs.exists(filenamePath)) {
// remove the file first
fs.delete(filenamePath);
}
FSDataOutputStream out = fs.create(filenamePath);
out.writeUTF("hello, world!");
out.close();
} catch (IOException ioe) {
System.err.println("IOException during operation: " + ioe.toString());
System.exit(1);
}
}
また、疑似分散モードでは何も書き込みません。ただし、スタンドアロンでは完璧に書きます。
問題はどこだ?