请根据您的内存资源考虑以下情况
容器的数量取决于块大小的数量。如果你有 512 mb 块大小的 2 GB 数据,Yarn 会创建 4 个 map 和 1 个 reduce。在运行 mapreduce 时,我们应该遵循一些规则来提交 mapreduce 作业。(这应该适用于小型集群)
您应该根据 RAM DISK 和 CORES 配置以下属性。
<property>
<description>The minimum allocation for every container request at the RM,
in MBs. Memory requests lower than this won't take effect,
and the specified value will get allocated at minimum.</description>
<name>yarn.scheduler.minimum-allocation-mb</name>
<value>512</value>
</property>
<property>
<description>The maximum allocation for every container request at the RM,
in MBs. Memory requests higher than this won't take effect,
and will get capped to this value.</description>
<name>yarn.scheduler.maximum-allocation-mb</name>
<value>2048</value>
</property>
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>2048</value>
</property>
并根据内存资源设置 Java 堆大小。一旦根据 mapreduce 在 yarn-site.xml 中确保了上述属性,就会有效地成功。