编译hadoop2.0(0.23.0)及运行的一些问题

来源:互联网 发布:google拼音 linux 编辑:程序博客网 时间:2024/05/16 14:26
svn co http://svn.apache.org/repos/asf/hadoop/common/tags/release-2.0.0-alpha xxx
  • linux: 参考$HADOOP_HOME/BUILDING.txt 及 $HADOOP_HOME/hadoop-mapreduce-project/INSTALL(ps,我开始没有注意这两个文件,所以我以下都是一步一步调试,纠结,痛苦中写出来了。)  
    1. 装protoc buffer http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.gz
    2. mvn install -Dmaven.skip.test即可。
    3. 产生部署tar包:mvn install -Dtar  -Pdist -Dmaven.javadoc.skip=true -DskipTests=true

  • win:
    1. 在win下面,首先下载cygwin:http://www.cygwin.com/ 在path中设置路径。
    2. 下载proto buffer http://code.google.com/p/protobuf/downloads/list如路径:http://code.google.com/p/protobuf/downloads/detail?name=protoc-2.4.1-win32.zip&can=2&q= 解压后把protoc.exe放在cygwin根目录的bin目录下面。
    3. 打上patch:https://issues.apache.org/jira/browse/MAPREDUCE-3881#comment-13478928 就是修改hadoop-mapreduce-project\hadoop-yarn\hadoop-yarn-common\pom.xml:https://issues.apache.org/jira/secure/attachment/12515081/pom.xml.patch
    4. mvn install -Dmaven.skip.test即可。
遇到的一些问题:附上最后的conf目录:https://github.com/lwwcl1314/apollo/tree/master/distrubutescript/conf-hadoop-2.0.0-alpha
  • 在eclipse中导入工程,在3.7版本中,出现通过f4找不到ClientRMProtocol的实现类ClientRMService。但是在3.6eclipse中可以。这个比较奇怪,让我不得不用3.6eclipse。
  • mvn install -Dtar  -Pdist -Dmaven.javadoc.skip=true  -Dmaven.test.skip=true打包过程中,出现:
    • [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.3:single (package-mapreduce) on project hadoop-mapreduce: Assembly is incorrectly configured: hadoop-mapreduce-dist: Assembly is incorrectly configured: hadoop-mapreduce-dist:[ERROR] Assembly: hadoop-mapreduce-dist is not configured correctly: Cannot find attachment with classifier: tests in module project: org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:2.0.0-alpha. Please exclude this module from the module-set.
      此我对hadoop-assemblies工程下的hadoop-mapreduce-dist.xml修改,开始我直接删除了moduleSets导致了,启动yarn报错。后我把<attachmentClassifier>tests</attachmentClassifier>注释掉了,我现在还不知道这个有啥左右。
    • 补充下,找到原因了。其实就是 -Dmaven.test.skip=true会跳过测试资源编译,这个测试会在maven-assembly-plugin用到。所以报错了。应该该用为-DskipTests=true。
  • hdfs格式化后,启动hdfs后。java.io.IOException: Incompatible clusterIDs in /tmp/hadoop-yarn/dfs/data: namenode clusterID = CID-2917fbbc-dcd7-40f3-8a1f-f222c3941fc1; datanode clusterID = CID-d53b270a-893f-4fa5-b5e5-1e5ed5ee4e86,需要把各个DN下/tmp/hadoop-yarn/dfs/ 下的文件全部删除。
  • 启动yarn 报错。
    • [yarn@hd19-vm1 sbin]$ ./start-yarn.shstarting yarn daemonsstarting resourcemanager, logging to /home/yarn/hadoop-2.0.0-alpha/logs/yarn-yarn-resourcemanager-hd19-vm1.yunti.yh.aliyun.com.outException in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/server/resourcemanager/ResourceManagerCaused by: java.lang.ClassNotFoundException: org.apache.hadoop.yarn.server.resourcemanager.ResourceManager        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      这是因为打包少了包的原因,主要是我自定对hadoop-assemblies工程下的hadoop-mapreduce-dist.xml修改的缘故。
  • mr始终在本地运行,因为配置问题,改为yarn的。
    • <property>  <name>mapreduce.framework.name</name>  <value>local</value>  <description>The runtime framework for executing MapReduce jobs.  Can be one of local, classic or yarn.  </description></property>
  • java.lang.IllegalStateException: Invalid shuffle port number -1 returned fo,这个问题我查了很久,主要是yarn对调试比较纠结。
    • Container launch failed for container_1350803453228_0002_01_000004 : java.lang.IllegalStateException: Invalid shuffle port number -1 returned for attempt_1350803453228_0002_r_000000_0        at org.apache.hadoop.mapreduce.v2.app.launcher.ContainerLauncherImpl$Container.launch(ContainerLauncherImpl.java:162)        at org.apache.hadoop.mapreduce.v2.app.launcher.ContainerLauncherImpl$EventProcessor.run(ContainerLauncherImpl.java:373)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)        at java.lang.Thread.run(Thread.java:636)
      解决方法其实很简单(框架也不默认下)是因为:yarn.nodemanager.aux-services没有配置mapreduce.shuffle
    • <property><name>yarn.nodemanager.aux-services</name><value>mapreduce.shuffle</value></property>
原创粉丝点击