我正在尝试在“在”文件夹中创建一个文件。但是当我尝试在群集中运行此文件时,我注意到此“in”文件夹不在hdfs中。
为什么会这样呢?
哪里不对了?
我的驱动程序代码是
Path in = new Path("in");
Path input = new Path("in/inputfile");
BufferedWriter createinput = new BufferedWriter(new OutputStreamWriter(fs.create(input)));
根据此代码,应该在集群的工作目录中创建一个“in”文件夹和一个文件“inputfile”,对吗?
最佳答案
试试这个
Path p = new Path(“hdfs://node1:50070/foo/bar”);
FileSystem fs = p.getFileSystem(conf);
DataOutputStream file = fs.create(p);
file.writeUTF(“hello\n”);
file.close();
关于hadoop - 未使用Hadoop Mapreduce代码创建的文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19970331/