记录遇到的一些Hadoop—Mapreduc相关的问题

一:类类型使用不一致(mapper和reduce)

20/01/13 16:03:42 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1578714121919_0001
20/01/13 16:03:42 INFO conf.Configuration: found resource resource-types.xml at file:/tmp/hadoop-unjar5833957221661452217/resource-types.xml
20/01/13 16:03:42 INFO resource.ResourceUtils: Adding resource type - name = rm1, units = G, type = COUNTABLE
20/01/13 16:03:42 INFO resource.ResourceUtils: Adding resource type - name =  rm2, units = , type = COUNTABLE
20/01/13 16:03:42 INFO resource.ResourceUtils: Adding resource type - name = memory-mb, units = Mi, type = COUNTABLE
20/01/13 16:03:42 INFO resource.ResourceUtils: Adding resource type - name = vcores, units = , type = COUNTABLE
20/01/13 16:03:43 INFO impl.YarnClientImpl: Submitted application application_1578714121919_0001
20/01/13 16:03:43 INFO mapreduce.Job: The url to track the job: http://node04:8088/proxy/application_1578714121919_0001/
20/01/13 16:03:43 INFO mapreduce.Job: Running job: job_1578714121919_0001
20/01/13 16:03:51 INFO mapreduce.Job: Job job_1578714121919_0001 running in uber mode : false
20/01/13 16:03:51 INFO mapreduce.Job:  map 0% reduce 0%
20/01/13 16:03:57 INFO mapreduce.Job:  map 100% reduce 0%
20/01/13 16:04:01 INFO mapreduce.Job: Task Id : attempt_1578714121919_0001_r_000000_0, Status : FAILED
Error: java.lang.ClassCastException: org.apache.hadoop.io.Text cannot be cast to org.apache.hadoop.util.bloom.Key
        at com.ideatech.hadoop.mapreduce.MyReduce.reduce(MyReduce.java:14)
        at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:171)
        at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:627)
        at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:389)
        at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:177)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1893)
        at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:171)

20/01/13 16:04:06 INFO mapreduce.Job: Task Id : attempt_1578714121919_0001_r_000000_1, Status : FAILED
View Code
 
  这是因为mapper和reduce的继承类,使用的T参数不一致造成,比如,map里面使用Text ,reduce里面使用Key,就会出现类型强转异常

二:2.10.0版本缺少配置文件(不同于低版本2.x)

  2.10.0需要配置相关的参数,yarn资源管理的相关参数,较之2.x低版本有较多区别

三:AM资源分配问题,始终在等待分配资源

  参考文章:https://www.cnblogs.com/yjt1993/p/9489122.html

四:缺少resource-types.xml 配置文件,低版本2.x不需要,高版本2.x和3.x需要,具体从哪个版本开始,未曾查明(参考如下)

  

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
    <property>
         <name>yarn.resource-types</name>
        <value>rm1, rm2</value>
    </property>
    <property>
        <name>yarn.resource-types.rm1.units</name>
        <value>G</value>
    </property>
    <property>
        <!-- Maximum resources to allocate to application masters
        If this is too high application masters can crowd out actual work -->
        <name>yarn.scheduler.capacity.maximum-am-resource-percent</name>
        <value>0.6</value>
    </property>
<!--    <property>-->
<!--        <name>yarn.scheduler.minimum-allocation-mb</name>-->
<!--        <value>1</value>-->
<!--    </property>-->
<!--    <property>-->
<!--        <name>yarn.scheduler.maximum-allocation-mb</name>-->
<!--        <value>1</value>-->
<!--    </property>-->

<!--    <property>-->
<!--        <name>yarn.resource-types.rm2.minimum</name>-->
<!--        <value>1</value>-->
<!--    </property>-->
<!--    <property>-->
<!--        <name>yarn.resource-types.rm2.maximum</name>-->
<!--        <value>1</value>-->
<!--     </property>-->
</configuration>

 

五:yarn资源管理分配未曾成功启动(下图是成功启动后的显示——HA模式)

  *:注意 Memory Total 和 Apps Completed ,VCores Used

   配置文件未正确配置

  

 

 

总结:Hadoop系列,1.x,2.x和3.x等几个大版本差异较大,若要进行操作,最好使用2.x偏中版本,3.x偏低,比如2.6 ,2.7之类,或者3.2或3.1(时间:20200113)。最好三阶段的异动和变革史能探索下。

posted on 2020-01-13 18:10  PandOne  阅读(283)  评论(0编辑  收藏  举报

导航