在YARN群集中的特定节点上运行我自己的应用程序母版 [英] Run my own application master on a specific node in a YARN cluster
问题描述
首先,我正在使用Hadoop-2.6.0。我想在YARN群集中的特定节点上启动我自己的应用程序主机,以便在预定的IP地址和端口上打开服务器。为此,我编写了一个驱动程序,在其中创建了一个 ResourceRequest 对象,并调用了 setResourceName 方法来设置主机名,并将其附加到 ApplicationSubmissionContext 通过调用 setAMContainerResourceRequest 方法来实现strong>对象。
First of all, I'm using Hadoop-2.6.0. I want to launch my own app master on a specific node in a YARN cluster in order to open a server on a predetermined IP address and port. To that end, I wrote a driver program in which I created a ResourceRequest object and called setResourceName method to set a hostname, and attached it to a ApplicationSubmissionContext object by calling setAMContainerResourceRequest method.
我尝试了几次,但是无法在特定节点上启动应用程序主机。搜索代码后,我发现 RMAppAttemptImpl 使我在 ResourceRequest 中设置的内容无效,如下所示:
I tried several times but couldn't launch the app master on a specific node. After searching code, I found that RMAppAttemptImpl invalidates what I've set in ResourceRequest as follows:
// Currently, following fields are all hard code,
// TODO: change these fields when we want to support
// priority/resource-name/relax-locality specification for AM containers
// allocation.
appAttempt.amReq.setNumContainers(1);
appAttempt.amReq.setPriority(AM_CONTAINER_PRIORITY);
appAttempt.amReq.setResourceName(ResourceRequest.ANY);
appAttempt.amReq.setRelaxLocality(true);
还有另一种方法可以在Hadoop-2.6的特定节点上为应用程序主服务器启动容器。 0?
Is there another way to launch a container for an application master on a specific node in Hadoop-2.6.0?
推荐答案
ApplicationSubmissionContext 提供了一个功能 setAMContainerResourceRequest ,您可以在其中传递 ResourceRequest 对象,您可以在ResourceRequest对象中设置 false RelaxLocality标志,该标志告知ResourceManager是否使用了离子希望位置宽松(例如允许掉落到机架或其他任何机架上)或严格(即在资源分配上指定硬约束)。然后使用 setResourceName 。希望对您有所帮助!
ApplicationSubmissionContext provides a function setAMContainerResourceRequest where you can pass a ResourceRequest object, In ResourceRequest object you can set "false" the RelaxLocality flag, which tells the ResourceManager if the application wants locality to be loose (i.e. allows fall-through to rack or any) or strict (i.e. specify hard constraint on resource allocation). Then set the hostname using setResourceName. I hope it helps!
这篇关于在YARN群集中的特定节点上运行我自己的应用程序母版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!