Hadoop windows编译:
可以略过这一段,直接下载hadoo2.7.1 bin文件,我的资源里有最终生成的winutils.exe和一些native code,放在bin目录就行了
参考building.txt以及http://wiki.apache.org/hadoop/Hadoop2OnWindows,编译条件:
* Windows System - win8
* JDK 1.7+ - jdk1.8
* Maven 3.0 or later - maven 3.3
* Findbugs 1.3.9 (if running findbugs) - None
* ProtocolBuffer 2.5.0 - 2.5 build by vs2013
* CMake 2.6 or newer - cmake3.3
* Windows SDK 7.1 or Visual Studio 2010 Professional - vs2010
* Windows SDK 8.1 (if building CPU rate control for the container executor)
* zlib headers (if building native code bindings for zlib)
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)
* Unix command-line tools from GnuWin32: sh, mkdir, rm, cp, tar, gzip. These
tools must be present on your PATH.
1. Unix command-line tools: http://git-scm.com/download/win
PATH环境变量设置C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin
想用gnuwin32的话,hosts文件需要添加(国内访问不了)
216.34.181.96 getgnuwin32.sourceforge.net
2. protocolbuffer 2.5.0 可以用vs2010/vs2013编译,几个工程需要加上 /FS
加上,#include <algorithm>
编译好的protoc.exe / libprotobuf.lib / libprotobuf-lite.lib / libprotoc.lib 放到c:/windows,打开CMD输入protoc,
3. 拷贝zlib1.dll(网上可以下载到,最好用1.2.7版本的)到C:/windows
4. 按编译过程中提示的错误信息,把C:\Java\jdk1.8.0_51\lib\tools.jar拷贝到C:\Java\jdk1.8.0_51\lib\
5. 打开CMD,注意JAVA_HOME目录中不要有Program file这样有空格
CALL "%VS100COMNTOOLS%..\..\VC\bin\vcvars32.bat"
set Platform=Win32
set JAVA_HOME=C:\Java\jdk1.8.0_51
cd e:/hadoop-2.7.1-src
mvn package -Pdist,native-win -DskipTests -Dtar
6. mvn可以多试几次,最终tar文件在hadoop-dist\target\
启动Hadoop:
配置hadoop可以完全参照linux下配置,需要注意的是:
1. 涉及到本机目录的地方,加上file:///,否则 hdfs namenode -format 会失败
file:///e:/nutch/hdfs/name
2. 可能会提示Error: missing `server' JVM at `C:\Java\jdk1.8.0_51\bin\server\jvm.dll'.
将C:\Java\jdk1.8.0_51\jre\bin\server 目录拷贝到C:\Java\jdk1.8.0_51\bin\
eclipse导入Nutch2.3:
1. windows下编译,ant runtime和linux差别不大
2. 导入nutch2.3,网上有例程。ant runtime以后再导入例程
打开eclipse,new - java project - ,基本就
可以finish了,还会有一些bug:
3. Run as - java appliction, 选择InjectorJob
4. 运行成功,先运行hadoop
5. InjectorJob: java.lang.NullPointerException
at java.lang.ProcessBuilder.start(Unknown Source)
或许需要重启一下eclipse:)