hadoop2.7.1 nutch2.3 二次开发windows环境
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编译,几个project须要加上 /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 会失败
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)
,同一时候HADOOP_HOME/bin增加到PATH能够解决
也许须要重新启动一下eclipse:)