MAPREDUCE-6404. Allow AM to specify a port range for starting its webapp. Contributed by Varun Saxena.

This commit is contained in:
Junping Du 2017-02-07 01:40:49 -08:00
parent d88497d44a
commit 7afe5b1a31
3 changed files with 18 additions and 2 deletions

View File

@ -142,7 +142,9 @@ protected void serviceStart() throws Exception {
// running in user-land.
webApp =
WebApps.$for("mapreduce", AppContext.class, appContext, "ws")
.withHttpPolicy(conf, Policy.HTTP_ONLY).start(new AMWebApp());
.withHttpPolicy(conf, Policy.HTTP_ONLY)
.withPortRange(conf, MRJobConfig.MR_AM_WEBAPP_PORT_RANGE)
.start(new AMWebApp());
} catch (Exception e) {
LOG.error("Webapps failed to start. Ignoring for now:", e);
}

View File

@ -592,7 +592,13 @@ public interface MRJobConfig {
*/
public static final String MR_AM_JOB_CLIENT_PORT_RANGE =
MR_AM_PREFIX + "job.client.port-range";
/**
* Range of ports that the MapReduce AM can use when binding for its webapp.
* Leave blank if you want all possible ports.
*/
String MR_AM_WEBAPP_PORT_RANGE = MR_AM_PREFIX + "webapp.port-range";
/** Enable blacklisting of nodes in the job.*/
public static final String MR_AM_JOB_NODE_BLACKLISTING_ENABLE =
MR_AM_PREFIX + "job.node-blacklisting.enable";

View File

@ -1388,6 +1388,14 @@
For example 50000-50050,50100-50200</description>
</property>
<property>
<name>yarn.app.mapreduce.am.webapp.port-range</name>
<value></value>
<description>Range of ports that the MapReduce AM can use for its webapp when binding.
Leave blank if you want all possible ports.
For example 50000-50050,50100-50200</description>
</property>
<property>
<name>yarn.app.mapreduce.am.job.committer.cancel-timeout</name>
<value>60000</value>