AWS EMR InvalidAuxServiceException:auxService:mapreduce_shuffle 不存在

AWS EMR InvalidAuxServiceException: The auxService:mapreduce_shuffle does not exist

我将根据用户事件在 运行 时间启动 EMR 集群,作业完成后集群将终止。

如何启动集群并执行任务时出现错误:

我读了一些帖子,其中建议我们需要更新名称节点和数据节点中的 yarn-site.xml 并重新启动 yarn 实例。

不确定如何在集群本身启动期间配置它。

org.apache.hadoop.yarn.exceptions.InvalidAuxServiceException: The auxService:mapreduce_shuffle does not exist

Container launch failed for container_1523533251407_0001_01_000002 : org.apache.hadoop.yarn.exceptions.InvalidAuxServiceException: The auxService:mapreduce_shuffle does not exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.instantiateException(SerializedExceptionPBImpl.java:168)
at org.apache.hadoop.yarn.api.records.impl.pb.SerializedExceptionPBImpl.deSerialize(SerializedExceptionPBImpl.java:106)
at org.apache.hadoop.mapreduce.v2.app.launcher.ContainerLauncherImpl$Container.launch(ContainerLauncherImpl.java:155)
at org.apache.hadoop.mapreduce.v2.app.launcher.ContainerLauncherImpl$EventProcessor.run(ContainerLauncherImpl.java:390)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

谢谢

答案:

这是我在代码中添加的用于解决问题的内容:

Map<String,String> yarnProperties = new HashMap<String,String>();
        yarnProperties.put("yarn.nodemanager.aux-services","mapreduce_shuffle");
        yarnProperties.put("yarn.nodemanager.aux-services.mapreduce_shuffle.class","org.apache.hadoop.mapred.ShuffleHandler");

        Configuration yarnConfig = new Configuration()
                .withClassification("yarn-env")
                .withProperties(yarnProperties);
RunJobFlowRequest request = new RunJobFlowRequest()
            .withConfigurations(yarnConfig)

我们正在 yarn-site.xml 中设置一些其他属性。

如果您尝试使用 AWS CLI 创建,您可以使用

--configurations 'json file with the config'

否则,如果您尝试通过 java 创建,例如

Application hive = new Application().withName("Hive");

Map<String,String> hiveProperties = new HashMap<String,String>();
    hiveProperties.put("hive.join.emit.interval","1000");
    hiveProperties.put("hive.merge.mapfiles","true");

Configuration myHiveConfig = new Configuration()
    .withClassification("hive-site")
    .withProperties(hiveProperties);

那你可以参考

RunJobFlowRequest request = new RunJobFlowRequest()
    .withName("Create cluster with ReleaseLabel")
    .withReleaseLabel("emr-5.13.0")
    .withApplications(hive)
    .withConfigurations(myHiveConfig)

对于另一个问题:-

您需要以上述方式添加这 2 个属性,然后创建集群:-

<configuration>
  <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
  </property>
  <property>
    <name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
    <value>org.apache.hadoop.mapred.ShuffleHandler</value>
  </property>
</configuration>