gpt4 book ai didi

hadoop - TaskTracker 为每个输入拆分或每个键值对生成一个新的映射器?

转载 作者:可可西里 更新时间:2023-11-01 16:57:51 28 4
gpt4 key购买 nike

我在某些网站上发现了以下问题,但我不确定正确答案。

Which Hadoop service in a MapReduce program spawns a new Mapper?

  1. JobTracker 生成一个新的 Mapper 来处理单个文件中的所有记录。
  2. TaskTracker 生成一个新的 Mapper 来处理每个键值对。
  3. TaskTracker 生成一个新的 Mapper 来处理单个输入拆分中的所有记录。
  4. JobTracker 调用TaskTrackerconfigure() 方法,然后是它的map() 方法,最后是它的 close () 方法。

网站上说答案是选项 2,但我对答案 3 感到困惑。

mapper 的 java 文档中,我发现了以下内容:

The Hadoop Map-Reduce framework spawns one map task for each InputSplit generated by the InputFormat for the job. Mapper implementations can access the Configuration for the job via theJobContext.getConfiguration().
The framework first calls setup(org.apache.hadoop.mapreduce.Mapper.Context), followed by map(Object, Object, Context) for each key/value pair in the InputSplit. Finally cleanup(Context) is called. All intermediate values associated with a given output key are subsequently grouped by the framework, and passed to a Reducer to determine the final output. Users can control the sorting and grouping by specifying two key RawComparator classes.

最佳答案

是2

Map Task是JVM

Mapper只是一个java类或者一个对象

作业调度程序为每个拆分创建一个映射任务:(MapReduce1 第 191 页 Hadoop 权威指南第 3 期)。

Application Master为每个split创建一个map任务对象:(MapReduce2同书第199页)

无论哪种情况,都不是 taskTrack 生成 Map 任务。

TaskTrack 生成 Mapper 类来处理每个键/值对。

关于hadoop - TaskTracker 为每个输入拆分或每个键值对生成一个新的映射器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27741112/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com