3. Hadoop开发环境介绍
如上图所示,我们可以选择在win中开发,也可以在linux中开发,本地启动Hadoop或者远程调用Hadoop,标配的工具都是Maven和Eclipse。
Hadoop集群系统环境:
Linux: Oracle linux Enterprise 5.9
Java: 1.6.0_30
Hadoop: hadoop-1.2.1,
三节点:
namenode: 10.1.32.91
datanode: 10.1.32.93
datanode: 10.1.32.95
4. 用Maven构建Hadoop环境· 1.用Maven创建一个标准化的Java项目
· 2.导入项目到eclipse
· 3.增加hadoop依赖,修改pom.xml
· 4.下载依赖
· 5.从Hadoop集群环境下载hadoop配置文件
· 6.配置本地host
1). 用Maven创建一个标准化的Java项目
C:\Users\licz>mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes-DgroupId=org.conan.myhadoop.mr -DartifactId=myHadoop -DpackageName=org.conan.myhadoop.mr-Dversion=1.0-SNAPSHOT -DinteractiveMode=false
[INFO]Scanning for projects...
[INFO]
[INFO]------------------------------------------------------------------------
[INFO]Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @standalone-pom >>>
[INFO]
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @standalone-pom <<<
[INFO]
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @standalone-pom ---
[INFO]Generating project in Batch mode
[INFO]No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Downloading:
Downloaded:
n-archetype-quickstart/1.0/maven-archetype-quickstart-1.0.jar(5 KB at 4.5 KB/sec)
Downloading:
Downloaded:(703 B at 1.2 KB/sec)
[INFO]----------------------------------------------------------------------------
[INFO]Using following parameters for creating project from Old (1.x)Archetype:maven-archetype-quickstart:1.0
[INFO]----------------------------------------------------------------------------
[INFO]Parameter: groupId, Value: org.conan.myhadoop.mr
[INFO]Parameter: packageName, Value: org.conan.myhadoop.mr
[INFO]Parameter: package, Value: org.conan.myhadoop.mr
[INFO]Parameter: artifactId, Value: myHadoop
[INFO]Parameter: basedir, Value: C:\Users\licz
[INFO]Parameter: version, Value: 1.0-SNAPSHOT
[INFO]project created from Old (1.x) Archetype in dir: C:\Users\licz\myHadoop
[INFO]------------------------------------------------------------------------
[INFO]BUILD SUCCESS
[INFO]------------------------------------------------------------------------
[INFO]Total time: 36.633s
[INFO]Finished at: Thu Jan 16 10:31:44 CST 2014
[INFO]Final Memory: 11M/490M
[INFO]------------------------------------------------------------------------
进入项目,执行mvn命令
C:\Users\licz>cd myHadoop
C:\Users\licz\myHadoop>mvn clean install
……
[INFO]Installing C:\Users\licz\myHadoop\target\myHadoop-1.0-SNAPSHOT.jar to C:\Users\licz\.m2\repository\org\conan\myhadoop\mr\myHadoop\1.0-SNAPSHOT\myHadoop-1.0-SNAPSHOT.jar
[INFO]Installing C:\Users\licz\myHadoop\pom.xml to C:\Users\licz\.m2\repository\org\conan\myhadoop\mr\myHadoop\1.0-SNAPSHOT\myHadoop-1.0-SNAPSHOT.pom
[INFO]------------------------------------------------------------------------
[INFO]BUILD SUCCESS
[INFO]------------------------------------------------------------------------
[INFO]Total time: 2:06.911s
[INFO]Finished at: Thu Jan 16 14:52:00 CST 2014
[INFO]Final Memory: 9M/490M
[INFO]------------------------------------------------------------------------