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

 

問題一、不能分配內存,錯誤提示以下:java

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)apache

 

  解決把法:安全

  問題緣由多是機器內存過小(2G),安裝Ubuntu時又沒有使用交換空間。oop

  修改conf下的hadoop-env.shui

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

 

問題2:JobTracker處於安全模式ip


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)

內存

  解決辦法:hadoop

  解除安全模式,以下命令:get

  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

相關文章
相關標籤/搜索