Bladeren bron

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

Junping Du 8 jaren geleden
bovenliggende
commit
7afe5b1a31

+ 3 - 1
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/client/MRClientService.java

@@ -142,7 +142,9 @@ public class MRClientService extends AbstractService implements ClientService {
       // 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);
     }

+ 7 - 1
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/MRJobConfig.java

@@ -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";

+ 8 - 0
hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/resources/mapred-default.xml

@@ -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>