Hadoop 在 Hadoop 2.7 上为每个容器添加超过 1 个内核

Hadoop Adding More Than 1 Core Per Container on Hadoop 2.7

我听说有一种方法可以在 Hadoop 2.7 yarn 中向 1 个容器添加 32 个内核或任何内核。

这可能吗?有人有我需要更改的示例配置吗?

测试将是 terasort,将我的 40 个核心添加到 1 个容器作业。

老实说,我不太了解 Hadoop 2.7,但如果映射器能够利用更多线程,则可以设置每个映射(或减少)容器的核心数通过在 mapred-site.xml 文件中设置这些属性:

mapreduce.map.cpu.vcores - The number of virtual cores to request from the scheduler for each map task.

mapreduce.reduce.cpu.vcores - The number of virtual cores to request from the scheduler for each reduce task.

请参考Hadoop documentation

以下是 vCore 的配置:

yarn.scheduler.maximum-allocation-vcores - 指定每个容器请求的最大 vCore 分配

通常在yarn-site.xml中,你将这个值设置为32。我想,任何大于32的值都会被YARN拒绝。

  <property>
    <name>yarn.scheduler.maximum-allocation-vcores</name>
    <value>32</value>
  </property>

如果不设置这个值,那么YARN RM取默认值,即“4”

public static final int DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES = 4;

如果你是运行一个MapReduce应用,那么你还需要多设置两个配置参数,在mapred-site.xml:

  • mapreduce.map.cpu.vcores - 映射任务调度程序请求的 vCore 数
  • mapreduce.reduce.cpu.vcores - 为 reduce 任务从调度程序请求的 vCore 数量

您的 mapper/reducer 请求的资源计算是在调度程序代码中完成的。如果您希望您的调度程序同时考虑内存和 CPUs 进行资源计算,那么您需要使用 "DominantResourceCalculator"(它同时考虑 CPU 和资源计算内存)

例如如果您使用的是 Capacity Scheduler,则需要在“capacity-scheduler.xml”文件中指定以下参数:

  <property>
    <name>yarn.scheduler.capacity.resource-calculator</name>
    <value>org.apache.hadoop.yarn.util.resource.DominantResourceCalculator</value>
  </property>

请检查这个link:http://www.cloudera.com/content/www/en-us/documentation/enterprise/latest/topics/cdh_ig_yarn_tuning.html

此处对各种配置参数进行了详细说明。