2012-02-29 241 views
2

我想从HDFS复制文件到本地文件系统进行预处理。下面的代码应该根据文档工作。尽管它不会提供任何错误消息,并且mapreduce作业运行平稳,但在本地硬盘上看不到任何输出。你认为问题是什么?谢谢。从HDFS复制文件到本地文件系统用JAVA

 try { 
      Path phdfs_input = new Path("hdfs://master:54310/user/hduser/conninput/"+value.toString()); 
      Path plocal_input = new Path("/home/hduser/Desktop/"+avlue.toString()); 
      FileSystem fs = FileSystem.get(context.getConfiguration()); 
      fs.copyToLocalFile(phdfs_input, plocal_input); 

      /* String localoutput_file = "/home/hduser/Destop/output/"+value.toString(); 
      String cmd1[] = {"mafia", "-mfi", ".5", "-ascii", "~/Desktop/"+value.toString(), localoutput_file }; 
      File mafia_dir = new File("/home/hduser/"); 
      ShellCommandExecutor s = new ShellCommandExecutor(cmd1, mafia_dir);*/ 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 

回答

2

尝试在Path构造使用/user/hduser/conninput/"+value.toString(),而不是提供master:54310部分。它应该从Configuration找出master:54310

相关问题