偽分布模式下執行wordcount實例時報錯解決辦法


 

問題1、不能分配內存,錯誤提示如下:

FAILED
java.lang.RuntimeException: Error while running command to get file permissions : java.io.IOException: Cannot run program "/bin/ls": java.io.IOException: error=12, Cannot allocate memory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:488)
    at org.apache.hadoop.util.Shell.runCommand(Shell.java:200)
    at org.apache.hadoop.util.Shell.run(Shell.java:182)
    at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:375)
    at org.apache.hadoop.util.Shell.execCommand(Shell.java:461)
    at org.apache.hadoop.util.Shell.execCommand(Shell.java:444)
    at org.apache.hadoop.fs.FileUtil.execCommand(FileUtil.java:712)
    at org.apache.hadoop.fs.RawLocalFileSystem$RawLocalFileStatus.loadPermissionInfo(RawLocalFileSystem.java:448)

 

  解決把法:

  問題原因可能是機器內存太小(2G),安裝Ubuntu時又沒有使用交換空間。

  修改conf下的hadoop-env.sh

  # The maximum amount of heap to use, in MB. Default is 1000.
  export HADOOP_HEAPSIZE=2000

 

問題2:JobTracker處於安全模式


13/10/12 09:25:14 ERROR security.UserGroupInformation: PriviledgedActionException as:hadoop cause:org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.mapred.SafeModeException: JobTracker is in safe mode
    at org.apache.hadoop.mapred.JobTracker.checkSafeMode(JobTracker.java:5178)

  解決辦法:

  解除安全模式,如下命令:

  bin/hadoop dfsadmin -safemode leave

 

  操作安全模式的參數:

  enter  進入安全模式

  leave  強制退出安全模式

  get  返回是否開啟安全模式

  wait  等待,一直到安全模式結束

  

問題3:output文件夾已存在

  假如程序的輸出路徑為output,如果該文件夾已經存在,會提示此錯誤。

  ERROR security.UserGroupInformation: PriviledgedActionException as:hadoop cause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory output already exists
org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory output already exists
    at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:137)

  解決辦法:執行下面命令刪除文件夾

  bin/hadoop dfs -rmr output

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM