hdfs里面有文件,用命令行为什么看不到?
北辰猫咪 2015-09-22 05:09:41 代码如下:
String localPath = "/root/wolf/temp/1.txt";
String hdfsPath = "/user/wolf/merge.txt";
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
fs.copyFromLocalFile(new Path(localPath), new Path(hdfsPath));
FileStatus[] fss = fs.listStatus(new Path("/user/wolf/"));
for(int i=0; i< fss.length; i++){
System.out.println(fss[i] .getPath().getName());
}
输出有两个文件;
然后命令行:hadoop fs -ls /user/wolf/
没有任何文件