1. MapReduce在Windows上运行的坑
-
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries
解决办法:
下载winutils.exe(http://public-repo-1.hortonworks.com/hdp-win-alpha/winutils.exe)
创建一个目录,比如C:\winutils\bin
将winutils.exe放入上述创建好的目录下
设置HADOOP_HOME=C:\winutils环境变量,并将其放入PATH变量中,例如%HADOOP_HOME%\bin
或者直接在程序中加入System.setProperty(“hadoop.home.dir”, “full path to the folder with winutils”); -
java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.createFileWithMode0(Ljava/lang/String;JJJI)Ljava/io/FileDescriptor
解决办法:
下载winutils.exe(http://public-repo-1.hortonworks.com/hdp-win-alpha/winutils.exe)和hadoop.dll(https://github.com/steveloughran/winutils/tree/master/hadoop-2.7.1/bin)
放这两个在%HADOOP_HOME%\bin下,同时hadoop.dll也放在C:\Windows\System32目录下