001    /**
002    * Licensed to the Apache Software Foundation (ASF) under one
003    * or more contributor license agreements.  See the NOTICE file
004    * distributed with this work for additional information
005    * regarding copyright ownership.  The ASF licenses this file
006    * to you under the Apache License, Version 2.0 (the
007    * "License"); you may not use this file except in compliance
008    * with the License.  You may obtain a copy of the License at
009    *
010    *     http://www.apache.org/licenses/LICENSE-2.0
011    *
012    * Unless required by applicable law or agreed to in writing, software
013    * distributed under the License is distributed on an "AS IS" BASIS,
014    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015    * See the License for the specific language governing permissions and
016    * limitations under the License.
017    */
018    
019    package org.apache.hadoop.yarn.conf;
020    
021    import java.net.InetSocketAddress;
022    import java.util.Arrays;
023    import java.util.Collections;
024    import java.util.List;
025    
026    import org.apache.hadoop.classification.InterfaceAudience.Private;
027    import org.apache.hadoop.classification.InterfaceAudience.Public;
028    import org.apache.hadoop.classification.InterfaceStability.Evolving;
029    import org.apache.hadoop.conf.Configuration;
030    import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
031    import org.apache.hadoop.http.HttpConfig;
032    import org.apache.hadoop.net.NetUtils;
033    import org.apache.hadoop.util.StringUtils;
034    import org.apache.hadoop.yarn.api.ApplicationConstants;
035    
036    @Public
037    @Evolving
038    public class YarnConfiguration extends Configuration {
039    
040      private static final String YARN_DEFAULT_XML_FILE = "yarn-default.xml";
041      private static final String YARN_SITE_XML_FILE = "yarn-site.xml";
042    
043      static {
044        Configuration.addDefaultResource(YARN_DEFAULT_XML_FILE);
045        Configuration.addDefaultResource(YARN_SITE_XML_FILE);
046      }
047    
048      //Configurations
049    
050      public static final String YARN_PREFIX = "yarn.";
051    
052      /** Delay before deleting resource to ease debugging of NM issues */
053      public static final String DEBUG_NM_DELETE_DELAY_SEC =
054        YarnConfiguration.NM_PREFIX + "delete.debug-delay-sec";
055      
056      ////////////////////////////////
057      // IPC Configs
058      ////////////////////////////////
059      public static final String IPC_PREFIX = YARN_PREFIX + "ipc.";
060    
061      /** Factory to create client IPC classes.*/
062      public static final String IPC_CLIENT_FACTORY_CLASS =
063        IPC_PREFIX + "client.factory.class";
064      public static final String DEFAULT_IPC_CLIENT_FACTORY_CLASS = 
065          "org.apache.hadoop.yarn.factories.impl.pb.RpcClientFactoryPBImpl";
066    
067      /** Factory to create server IPC classes.*/
068      public static final String IPC_SERVER_FACTORY_CLASS = 
069        IPC_PREFIX + "server.factory.class";
070      public static final String DEFAULT_IPC_SERVER_FACTORY_CLASS = 
071          "org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl";
072    
073      /** Factory to create serializeable records.*/
074      public static final String IPC_RECORD_FACTORY_CLASS = 
075        IPC_PREFIX + "record.factory.class";
076      public static final String DEFAULT_IPC_RECORD_FACTORY_CLASS = 
077          "org.apache.hadoop.yarn.factories.impl.pb.RecordFactoryPBImpl";
078    
079      /** RPC class implementation*/
080      public static final String IPC_RPC_IMPL =
081        IPC_PREFIX + "rpc.class";
082      public static final String DEFAULT_IPC_RPC_IMPL = 
083        "org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC";
084      
085      ////////////////////////////////
086      // Resource Manager Configs
087      ////////////////////////////////
088      public static final String RM_PREFIX = "yarn.resourcemanager.";
089    
090      public static final String RM_CLUSTER_ID = RM_PREFIX + "cluster-id";
091    
092      /** The address of the applications manager interface in the RM.*/
093      public static final String RM_ADDRESS = 
094        RM_PREFIX + "address";
095      public static final int DEFAULT_RM_PORT = 8032;
096      public static final String DEFAULT_RM_ADDRESS =
097        "0.0.0.0:" + DEFAULT_RM_PORT;
098    
099      /** The number of threads used to handle applications manager requests.*/
100      public static final String RM_CLIENT_THREAD_COUNT =
101        RM_PREFIX + "client.thread-count";
102      public static final int DEFAULT_RM_CLIENT_THREAD_COUNT = 50;
103    
104      /** The Kerberos principal for the resource manager.*/
105      public static final String RM_PRINCIPAL =
106        RM_PREFIX + "principal";
107      
108      /** The address of the scheduler interface.*/
109      public static final String RM_SCHEDULER_ADDRESS = 
110        RM_PREFIX + "scheduler.address";
111      public static final int DEFAULT_RM_SCHEDULER_PORT = 8030;
112      public static final String DEFAULT_RM_SCHEDULER_ADDRESS = "0.0.0.0:" +
113        DEFAULT_RM_SCHEDULER_PORT;
114    
115      /** Miniumum request grant-able by the RM scheduler. */
116      public static final String RM_SCHEDULER_MINIMUM_ALLOCATION_MB =
117        YARN_PREFIX + "scheduler.minimum-allocation-mb";
118      public static final int DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB = 1024;
119      public static final String RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES =
120          YARN_PREFIX + "scheduler.minimum-allocation-vcores";
121        public static final int DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES = 1;
122    
123      /** Maximum request grant-able by the RM scheduler. */
124      public static final String RM_SCHEDULER_MAXIMUM_ALLOCATION_MB =
125        YARN_PREFIX + "scheduler.maximum-allocation-mb";
126      public static final int DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB = 8192;
127      public static final String RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES =
128          YARN_PREFIX + "scheduler.maximum-allocation-vcores";
129      public static final int DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES = 4;
130    
131      /** Number of threads to handle scheduler interface.*/
132      public static final String RM_SCHEDULER_CLIENT_THREAD_COUNT =
133        RM_PREFIX + "scheduler.client.thread-count";
134      public static final int DEFAULT_RM_SCHEDULER_CLIENT_THREAD_COUNT = 50;
135    
136      /** If the port should be included or not in the node name. The node name
137       * is used by the scheduler for resource requests allocation location 
138       * matching. Typically this is just the hostname, using the port is needed
139       * when using minicluster and specific NM are required.*/
140      public static final String RM_SCHEDULER_INCLUDE_PORT_IN_NODE_NAME =
141          YARN_PREFIX + "scheduler.include-port-in-node-name";
142      public static final boolean DEFAULT_RM_SCHEDULER_USE_PORT_FOR_NODE_NAME = 
143          false;
144    
145      /**
146       * Enable periodic monitor threads.
147       * @see #RM_SCHEDULER_MONITOR_POLICIES
148       */
149      public static final String RM_SCHEDULER_ENABLE_MONITORS =
150        RM_PREFIX + "scheduler.monitor.enable";
151      public static final boolean DEFAULT_RM_SCHEDULER_ENABLE_MONITORS = false;
152    
153      /** List of SchedulingEditPolicy classes affecting the scheduler. */
154      public static final String RM_SCHEDULER_MONITOR_POLICIES =
155        RM_PREFIX + "scheduler.monitor.policies";
156    
157      /** The address of the RM web application.*/
158      public static final String RM_WEBAPP_ADDRESS = 
159        RM_PREFIX + "webapp.address";
160    
161      public static final int DEFAULT_RM_WEBAPP_PORT = 8088;
162      public static final String DEFAULT_RM_WEBAPP_ADDRESS = "0.0.0.0:" +
163        DEFAULT_RM_WEBAPP_PORT;
164      
165      /** The https address of the RM web application.*/
166      public static final String RM_WEBAPP_HTTPS_ADDRESS =
167          RM_PREFIX + "webapp.https.address";
168      
169      public static final int DEFAULT_RM_WEBAPP_HTTPS_PORT = 8090;
170      public static final String DEFAULT_RM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
171          + DEFAULT_RM_WEBAPP_HTTPS_PORT;
172      
173      public static final String RM_RESOURCE_TRACKER_ADDRESS =
174        RM_PREFIX + "resource-tracker.address";
175      public static final int DEFAULT_RM_RESOURCE_TRACKER_PORT = 8031;
176      public static final String DEFAULT_RM_RESOURCE_TRACKER_ADDRESS =
177        "0.0.0.0:" + DEFAULT_RM_RESOURCE_TRACKER_PORT;
178    
179      /** The expiry interval for application master reporting.*/
180      public static final String RM_AM_EXPIRY_INTERVAL_MS = 
181        YARN_PREFIX  + "am.liveness-monitor.expiry-interval-ms";
182      public static final int DEFAULT_RM_AM_EXPIRY_INTERVAL_MS = 600000;
183    
184      /** How long to wait until a node manager is considered dead.*/
185      public static final String RM_NM_EXPIRY_INTERVAL_MS = 
186        YARN_PREFIX + "nm.liveness-monitor.expiry-interval-ms";
187      public static final int DEFAULT_RM_NM_EXPIRY_INTERVAL_MS = 600000;
188    
189      /** Are acls enabled.*/
190      public static final String YARN_ACL_ENABLE = 
191        YARN_PREFIX + "acl.enable";
192      public static final boolean DEFAULT_YARN_ACL_ENABLE = false;
193      
194      /** ACL of who can be admin of YARN cluster.*/
195      public static final String YARN_ADMIN_ACL = 
196        YARN_PREFIX + "admin.acl";
197      public static final String DEFAULT_YARN_ADMIN_ACL = "*";
198      
199      /** ACL used in case none is found. Allows nothing. */
200      public static final String DEFAULT_YARN_APP_ACL = " ";
201    
202      /** The address of the RM admin interface.*/
203      public static final String RM_ADMIN_ADDRESS = 
204        RM_PREFIX + "admin.address";
205      public static final int DEFAULT_RM_ADMIN_PORT = 8033;
206      public static final String DEFAULT_RM_ADMIN_ADDRESS = "0.0.0.0:" +
207          DEFAULT_RM_ADMIN_PORT;
208      
209      /**Number of threads used to handle RM admin interface.*/
210      public static final String RM_ADMIN_CLIENT_THREAD_COUNT =
211        RM_PREFIX + "admin.client.thread-count";
212      public static final int DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT = 1;
213      
214      /**
215       * The maximum number of application attempts.
216       * It's a global setting for all application masters.
217       */
218      public static final String RM_AM_MAX_ATTEMPTS =
219        RM_PREFIX + "am.max-attempts";
220      public static final int DEFAULT_RM_AM_MAX_ATTEMPTS = 2;
221      
222      /** The keytab for the resource manager.*/
223      public static final String RM_KEYTAB = 
224        RM_PREFIX + "keytab";
225    
226      /**The kerberos principal to be used for spnego filter for RM.*/
227      public static final String RM_WEBAPP_SPNEGO_USER_NAME_KEY =
228          RM_PREFIX + "webapp.spnego-principal";
229      
230      /**The kerberos keytab to be used for spnego filter for RM.*/
231      public static final String RM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY =
232          RM_PREFIX + "webapp.spnego-keytab-file";
233    
234      /** How long to wait until a container is considered dead.*/
235      public static final String RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS = 
236        RM_PREFIX + "rm.container-allocation.expiry-interval-ms";
237      public static final int DEFAULT_RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS = 600000;
238      
239      /** Path to file with nodes to include.*/
240      public static final String RM_NODES_INCLUDE_FILE_PATH = 
241        RM_PREFIX + "nodes.include-path";
242      public static final String DEFAULT_RM_NODES_INCLUDE_FILE_PATH = "";
243      
244      /** Path to file with nodes to exclude.*/
245      public static final String RM_NODES_EXCLUDE_FILE_PATH = 
246        RM_PREFIX + "nodes.exclude-path";
247      public static final String DEFAULT_RM_NODES_EXCLUDE_FILE_PATH = "";
248      
249      /** Number of threads to handle resource tracker calls.*/
250      public static final String RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT =
251        RM_PREFIX + "resource-tracker.client.thread-count";
252      public static final int DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT = 50;
253      
254      /** The class to use as the resource scheduler.*/
255      public static final String RM_SCHEDULER = 
256        RM_PREFIX + "scheduler.class";
257     
258      public static final String DEFAULT_RM_SCHEDULER = 
259          "org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler";
260    
261      /** RM set next Heartbeat interval for NM */
262      public static final String RM_NM_HEARTBEAT_INTERVAL_MS =
263          RM_PREFIX + "nodemanagers.heartbeat-interval-ms";
264      public static final long DEFAULT_RM_NM_HEARTBEAT_INTERVAL_MS = 1000;
265    
266      //Delegation token related keys
267      public static final String  DELEGATION_KEY_UPDATE_INTERVAL_KEY = 
268        RM_PREFIX + "delegation.key.update-interval";
269      public static final long    DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT = 
270        24*60*60*1000; // 1 day
271      public static final String  DELEGATION_TOKEN_RENEW_INTERVAL_KEY = 
272        RM_PREFIX + "delegation.token.renew-interval";
273      public static final long    DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT = 
274        24*60*60*1000;  // 1 day
275      public static final String  DELEGATION_TOKEN_MAX_LIFETIME_KEY = 
276         RM_PREFIX + "delegation.token.max-lifetime";
277      public static final long    DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT = 
278        7*24*60*60*1000; // 7 days
279      
280      public static final String RECOVERY_ENABLED = RM_PREFIX + "recovery.enabled";
281      public static final boolean DEFAULT_RM_RECOVERY_ENABLED = false;
282    
283      /** Zookeeper interaction configs */
284      public static final String RM_ZK_PREFIX = RM_PREFIX + "zk-";
285    
286      public static final String RM_ZK_ADDRESS = RM_ZK_PREFIX + "address";
287    
288      public static final String RM_ZK_NUM_RETRIES = RM_ZK_PREFIX + "num-retries";
289      public static final int DEFAULT_ZK_RM_NUM_RETRIES = 500;
290    
291      public static final String RM_ZK_RETRY_INTERVAL_MS =
292          RM_ZK_PREFIX + "retry-interval-ms";
293      public static final long DEFAULT_RM_ZK_RETRY_INTERVAL_MS = 2000;
294    
295      public static final String RM_ZK_TIMEOUT_MS = RM_ZK_PREFIX + "timeout-ms";
296      public static final int DEFAULT_RM_ZK_TIMEOUT_MS = 10000;
297    
298      public static final String RM_ZK_ACL = RM_ZK_PREFIX + "acl";
299      public static final String DEFAULT_RM_ZK_ACL = "world:anyone:rwcda";
300    
301      public static final String ZK_STATE_STORE_PREFIX =
302          RM_PREFIX + "zk-state-store.";
303    
304      /** Parent znode path under which ZKRMStateStore will create znodes */
305      public static final String ZK_RM_STATE_STORE_PARENT_PATH =
306          ZK_STATE_STORE_PREFIX + "parent-path";
307      public static final String DEFAULT_ZK_RM_STATE_STORE_PARENT_PATH = "/rmstore";
308    
309      /** Root node ACLs for fencing */
310      public static final String ZK_RM_STATE_STORE_ROOT_NODE_ACL =
311          ZK_STATE_STORE_PREFIX + "root-node.acl";
312    
313      /** HA related configs */
314      public static final String RM_HA_PREFIX = RM_PREFIX + "ha.";
315      public static final String RM_HA_ENABLED = RM_HA_PREFIX + "enabled";
316      public static final boolean DEFAULT_RM_HA_ENABLED = false;
317    
318      public static final String RM_HA_IDS = RM_HA_PREFIX + "rm-ids";
319      public static final String RM_HA_ID = RM_HA_PREFIX + "id";
320    
321      @Private
322      public static final List<String> RM_SERVICES_ADDRESS_CONF_KEYS =
323          Collections.unmodifiableList(Arrays.asList(
324              RM_ADDRESS,
325              RM_SCHEDULER_ADDRESS,
326              RM_ADMIN_ADDRESS,
327              RM_RESOURCE_TRACKER_ADDRESS,
328              HttpConfig.isSecure() ? RM_WEBAPP_HTTPS_ADDRESS
329                  : RM_WEBAPP_ADDRESS));
330    
331      public static final String AUTO_FAILOVER_PREFIX =
332          RM_HA_PREFIX + "automatic-failover.";
333    
334      public static final String AUTO_FAILOVER_ENABLED =
335          AUTO_FAILOVER_PREFIX + "enabled";
336      public static final boolean DEFAULT_AUTO_FAILOVER_ENABLED = false;
337    
338      public static final String AUTO_FAILOVER_EMBEDDED =
339          AUTO_FAILOVER_PREFIX + "embedded";
340      public static final boolean DEFAULT_AUTO_FAILOVER_EMBEDDED = false;
341    
342      public static final String AUTO_FAILOVER_ZK_BASE_PATH =
343          AUTO_FAILOVER_PREFIX + "zk-base-path";
344      public static final String DEFAULT_AUTO_FAILOVER_ZK_BASE_PATH =
345          "/yarn-leader-election";
346    
347      public static final String CLIENT_FAILOVER_PREFIX =
348          YARN_PREFIX + "client.failover-";
349      public static final String CLIENT_FAILOVER_PROXY_PROVIDER =
350          CLIENT_FAILOVER_PREFIX + "proxy-provider";
351      public static final String DEFAULT_CLIENT_FAILOVER_PROXY_PROVIDER =
352          "org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider";
353    
354      public static final String CLIENT_FAILOVER_MAX_ATTEMPTS =
355          CLIENT_FAILOVER_PREFIX + "max-attempts";
356    
357      public static final String CLIENT_FAILOVER_SLEEPTIME_BASE_MS =
358          CLIENT_FAILOVER_PREFIX + "sleep-base-ms";
359    
360      public static final String CLIENT_FAILOVER_SLEEPTIME_MAX_MS =
361          CLIENT_FAILOVER_PREFIX + "sleep-max-ms";
362    
363      public static final String CLIENT_FAILOVER_RETRIES =
364          CLIENT_FAILOVER_PREFIX + "retries";
365      public static final int DEFAULT_CLIENT_FAILOVER_RETRIES = 0;
366    
367      public static final String CLIENT_FAILOVER_RETRIES_ON_SOCKET_TIMEOUTS =
368          CLIENT_FAILOVER_PREFIX + "retries-on-socket-timeouts";
369      public static final int
370          DEFAULT_CLIENT_FAILOVER_RETRIES_ON_SOCKET_TIMEOUTS = 0;
371    
372      ////////////////////////////////
373      // RM state store configs
374      ////////////////////////////////
375      /** The class to use as the persistent store.*/
376      public static final String RM_STORE = RM_PREFIX + "store.class";
377      
378      /** URI for FileSystemRMStateStore */
379      public static final String FS_RM_STATE_STORE_URI = RM_PREFIX
380          + "fs.state-store.uri";
381      public static final String FS_RM_STATE_STORE_RETRY_POLICY_SPEC = RM_PREFIX
382          + "fs.state-store.retry-policy-spec";
383      public static final String DEFAULT_FS_RM_STATE_STORE_RETRY_POLICY_SPEC =
384          "2000, 500";
385    
386      /** The maximum number of completed applications RM keeps. */ 
387      public static final String RM_MAX_COMPLETED_APPLICATIONS =
388        RM_PREFIX + "max-completed-applications";
389      public static final int DEFAULT_RM_MAX_COMPLETED_APPLICATIONS = 10000;
390    
391      /**
392       * The maximum number of completed applications RM state store keeps, by
393       * default equals to DEFAULT_RM_MAX_COMPLETED_APPLICATIONS
394       */
395      public static final String RM_STATE_STORE_MAX_COMPLETED_APPLICATIONS =
396          RM_PREFIX + "state-store.max-completed-applications";
397      public static final int DEFAULT_RM_STATE_STORE_MAX_COMPLETED_APPLICATIONS =
398          DEFAULT_RM_MAX_COMPLETED_APPLICATIONS;
399    
400      /** Default application name */
401      public static final String DEFAULT_APPLICATION_NAME = "N/A";
402    
403      /** Default application type */
404      public static final String DEFAULT_APPLICATION_TYPE = "YARN";
405    
406      /** Default application type length */
407      public static final int APPLICATION_TYPE_LENGTH = 20;
408      
409      /** Default queue name */
410      public static final String DEFAULT_QUEUE_NAME = "default";
411    
412      /**
413       * Buckets (in minutes) for the number of apps running in each queue.
414       */
415      public static final String RM_METRICS_RUNTIME_BUCKETS =
416        RM_PREFIX + "metrics.runtime.buckets";
417    
418      /**
419       * Default sizes of the runtime metric buckets in minutes.
420       */
421      public static final String DEFAULT_RM_METRICS_RUNTIME_BUCKETS = 
422        "60,300,1440";
423    
424      public static final String RM_AMRM_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS = RM_PREFIX
425          + "am-rm-tokens.master-key-rolling-interval-secs";
426    
427      public static final long DEFAULT_RM_AMRM_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
428          24 * 60 * 60;
429    
430      public static final String RM_CONTAINER_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
431          RM_PREFIX + "container-tokens.master-key-rolling-interval-secs";
432    
433      public static final long DEFAULT_RM_CONTAINER_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
434          24 * 60 * 60;
435    
436      public static final String RM_NMTOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
437          RM_PREFIX + "nm-tokens.master-key-rolling-interval-secs";
438      
439      public static final long DEFAULT_RM_NMTOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
440          24 * 60 * 60;
441    
442      public static final String RM_NODEMANAGER_MINIMUM_VERSION =
443          RM_PREFIX + "nodemanager.minimum.version";
444    
445      public static final String DEFAULT_RM_NODEMANAGER_MINIMUM_VERSION =
446          "NONE";
447    
448      ////////////////////////////////
449      // Node Manager Configs
450      ////////////////////////////////
451      
452      /** Prefix for all node manager configs.*/
453      public static final String NM_PREFIX = "yarn.nodemanager.";
454    
455      /** Environment variables that will be sent to containers.*/
456      public static final String NM_ADMIN_USER_ENV = NM_PREFIX + "admin-env";
457      public static final String DEFAULT_NM_ADMIN_USER_ENV = "MALLOC_ARENA_MAX=$MALLOC_ARENA_MAX";
458    
459      /** Environment variables that containers may override rather than use NodeManager's default.*/
460      public static final String NM_ENV_WHITELIST = NM_PREFIX + "env-whitelist";
461      public static final String DEFAULT_NM_ENV_WHITELIST = StringUtils.join(",",
462        Arrays.asList(ApplicationConstants.Environment.JAVA_HOME.key(),
463          ApplicationConstants.Environment.HADOOP_COMMON_HOME.key(),
464          ApplicationConstants.Environment.HADOOP_HDFS_HOME.key(),
465          ApplicationConstants.Environment.HADOOP_CONF_DIR.key(),
466          ApplicationConstants.Environment.HADOOP_YARN_HOME.key()));
467      
468      /** address of node manager IPC.*/
469      public static final String NM_ADDRESS = NM_PREFIX + "address";
470      public static final int DEFAULT_NM_PORT = 0;
471      public static final String DEFAULT_NM_ADDRESS = "0.0.0.0:"
472          + DEFAULT_NM_PORT;
473      
474      /** who will execute(launch) the containers.*/
475      public static final String NM_CONTAINER_EXECUTOR = 
476        NM_PREFIX + "container-executor.class";
477    
478      /**  
479       * Adjustment to make to the container os scheduling priority.
480       * The valid values for this could vary depending on the platform.
481       * On Linux, higher values mean run the containers at a less 
482       * favorable priority than the NM. 
483       * The value specified is an int.
484       */
485      public static final String NM_CONTAINER_EXECUTOR_SCHED_PRIORITY = 
486        NM_PREFIX + "container-executor.os.sched.priority.adjustment";
487      public static final int DEFAULT_NM_CONTAINER_EXECUTOR_SCHED_PRIORITY = 0;
488      
489      /** Number of threads container manager uses.*/
490      public static final String NM_CONTAINER_MGR_THREAD_COUNT =
491        NM_PREFIX + "container-manager.thread-count";
492      public static final int DEFAULT_NM_CONTAINER_MGR_THREAD_COUNT = 20;
493      
494      /** Number of threads used in cleanup.*/
495      public static final String NM_DELETE_THREAD_COUNT = 
496        NM_PREFIX +  "delete.thread-count";
497      public static final int DEFAULT_NM_DELETE_THREAD_COUNT = 4;
498      
499      /** Keytab for NM.*/
500      public static final String NM_KEYTAB = NM_PREFIX + "keytab";
501      
502      /**List of directories to store localized files in.*/
503      public static final String NM_LOCAL_DIRS = NM_PREFIX + "local-dirs";
504      public static final String DEFAULT_NM_LOCAL_DIRS = "/tmp/nm-local-dir";
505    
506      /**
507       * Number of files in each localized directories
508       * Avoid tuning this too low. 
509       */
510      public static final String NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY =
511        NM_PREFIX + "local-cache.max-files-per-directory";
512      public static final int DEFAULT_NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY = 8192;
513    
514      /** Address where the localizer IPC is.*/
515      public static final String NM_LOCALIZER_ADDRESS =
516        NM_PREFIX + "localizer.address";
517      public static final int DEFAULT_NM_LOCALIZER_PORT = 8040;
518      public static final String DEFAULT_NM_LOCALIZER_ADDRESS = "0.0.0.0:" +
519        DEFAULT_NM_LOCALIZER_PORT;
520      
521      /** Interval in between cache cleanups.*/
522      public static final String NM_LOCALIZER_CACHE_CLEANUP_INTERVAL_MS =
523        NM_PREFIX + "localizer.cache.cleanup.interval-ms";
524      public static final long DEFAULT_NM_LOCALIZER_CACHE_CLEANUP_INTERVAL_MS = 
525        10 * 60 * 1000;
526      
527      /** Target size of localizer cache in MB, per local directory.*/
528      public static final String NM_LOCALIZER_CACHE_TARGET_SIZE_MB =
529        NM_PREFIX + "localizer.cache.target-size-mb";
530      public static final long DEFAULT_NM_LOCALIZER_CACHE_TARGET_SIZE_MB = 10 * 1024;
531      
532      /** Number of threads to handle localization requests.*/
533      public static final String NM_LOCALIZER_CLIENT_THREAD_COUNT =
534        NM_PREFIX + "localizer.client.thread-count";
535      public static final int DEFAULT_NM_LOCALIZER_CLIENT_THREAD_COUNT = 5;
536      
537      /** Number of threads to use for localization fetching.*/
538      public static final String NM_LOCALIZER_FETCH_THREAD_COUNT = 
539        NM_PREFIX + "localizer.fetch.thread-count";
540      public static final int DEFAULT_NM_LOCALIZER_FETCH_THREAD_COUNT = 4;
541    
542      /** Where to store container logs.*/
543      public static final String NM_LOG_DIRS = NM_PREFIX + "log-dirs";
544      public static final String DEFAULT_NM_LOG_DIRS = "/tmp/logs";
545    
546      public static final String NM_RESOURCEMANAGER_MINIMUM_VERSION =
547          NM_PREFIX + "resourcemanager.minimum.version";
548      public static final String DEFAULT_NM_RESOURCEMANAGER_MINIMUM_VERSION = "NONE";
549    
550      /** Interval at which the delayed token removal thread runs */
551      public static final String RM_DELAYED_DELEGATION_TOKEN_REMOVAL_INTERVAL_MS =
552          RM_PREFIX + "delayed.delegation-token.removal-interval-ms";
553      public static final long DEFAULT_RM_DELAYED_DELEGATION_TOKEN_REMOVAL_INTERVAL_MS =
554          30000l;
555      
556      /** Delegation Token renewer thread count */
557      public static final String RM_DELEGATION_TOKEN_RENEWER_THREAD_COUNT =
558          RM_PREFIX + "delegation-token-renewer.thread-count";
559      public static final int DEFAULT_RM_DELEGATION_TOKEN_RENEWER_THREAD_COUNT = 50;
560    
561      /** Whether to enable log aggregation */
562      public static final String LOG_AGGREGATION_ENABLED = YARN_PREFIX
563          + "log-aggregation-enable";
564      public static final boolean DEFAULT_LOG_AGGREGATION_ENABLED = false;
565      
566      /** 
567       * How long to wait before deleting aggregated logs, -1 disables.
568       * Be careful set this too small and you will spam the name node.
569       */
570      public static final String LOG_AGGREGATION_RETAIN_SECONDS = YARN_PREFIX
571          + "log-aggregation.retain-seconds";
572      public static final long DEFAULT_LOG_AGGREGATION_RETAIN_SECONDS = -1;
573      
574      /**
575       * How long to wait between aggregated log retention checks. If set to
576       * a value <= 0 then the value is computed as one-tenth of the log retention
577       * setting. Be careful set this too small and you will spam the name node.
578       */
579      public static final String LOG_AGGREGATION_RETAIN_CHECK_INTERVAL_SECONDS =
580          YARN_PREFIX + "log-aggregation.retain-check-interval-seconds";
581      public static final long DEFAULT_LOG_AGGREGATION_RETAIN_CHECK_INTERVAL_SECONDS = -1;
582    
583      /**
584       * Number of seconds to retain logs on the NodeManager. Only applicable if Log
585       * aggregation is disabled
586       */
587      public static final String NM_LOG_RETAIN_SECONDS = NM_PREFIX
588          + "log.retain-seconds";
589    
590      /**
591       * Number of threads used in log cleanup. Only applicable if Log aggregation
592       * is disabled
593       */
594      public static final String NM_LOG_DELETION_THREADS_COUNT = 
595        NM_PREFIX +  "log.deletion-threads-count";
596      public static final int DEFAULT_NM_LOG_DELETE_THREAD_COUNT = 4;
597    
598      /** Where to aggregate logs to.*/
599      public static final String NM_REMOTE_APP_LOG_DIR = 
600        NM_PREFIX + "remote-app-log-dir";
601      public static final String DEFAULT_NM_REMOTE_APP_LOG_DIR = "/tmp/logs";
602    
603      /**
604       * The remote log dir will be created at
605       * NM_REMOTE_APP_LOG_DIR/${user}/NM_REMOTE_APP_LOG_DIR_SUFFIX/${appId}
606       */
607      public static final String NM_REMOTE_APP_LOG_DIR_SUFFIX = 
608        NM_PREFIX + "remote-app-log-dir-suffix";
609      public static final String DEFAULT_NM_REMOTE_APP_LOG_DIR_SUFFIX="logs";
610    
611      public static final String YARN_LOG_SERVER_URL =
612        YARN_PREFIX + "log.server.url";
613      
614      public static final String YARN_TRACKING_URL_GENERATOR = 
615          YARN_PREFIX + "tracking.url.generator";
616    
617      /** Amount of memory in GB that can be allocated for containers.*/
618      public static final String NM_PMEM_MB = NM_PREFIX + "resource.memory-mb";
619      public static final int DEFAULT_NM_PMEM_MB = 8 * 1024;
620    
621      /** Specifies whether physical memory check is enabled. */
622      public static final String NM_PMEM_CHECK_ENABLED = NM_PREFIX
623          + "pmem-check-enabled";
624      public static final boolean DEFAULT_NM_PMEM_CHECK_ENABLED = true;
625    
626      /** Specifies whether physical memory check is enabled. */
627      public static final String NM_VMEM_CHECK_ENABLED = NM_PREFIX
628          + "vmem-check-enabled";
629      public static final boolean DEFAULT_NM_VMEM_CHECK_ENABLED = true;
630    
631      /** Conversion ratio for physical memory to virtual memory. */
632      public static final String NM_VMEM_PMEM_RATIO =
633        NM_PREFIX + "vmem-pmem-ratio";
634      public static final float DEFAULT_NM_VMEM_PMEM_RATIO = 2.1f;
635      
636      /** Number of Virtual CPU Cores which can be allocated for containers.*/
637      public static final String NM_VCORES = NM_PREFIX + "resource.cpu-vcores";
638      public static final int DEFAULT_NM_VCORES = 8;
639      
640      /** NM Webapp address.**/
641      public static final String NM_WEBAPP_ADDRESS = NM_PREFIX + "webapp.address";
642      public static final int DEFAULT_NM_WEBAPP_PORT = 8042;
643      public static final String DEFAULT_NM_WEBAPP_ADDRESS = "0.0.0.0:" +
644        DEFAULT_NM_WEBAPP_PORT;
645      
646      /** NM Webapp https address.**/
647      public static final String NM_WEBAPP_HTTPS_ADDRESS = NM_PREFIX
648          + "webapp.https.address";
649      public static final int DEFAULT_NM_WEBAPP_HTTPS_PORT = 8044;
650      public static final String DEFAULT_NM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
651          + DEFAULT_NM_WEBAPP_HTTPS_PORT; 
652      
653      /** How often to monitor containers.*/
654      public final static String NM_CONTAINER_MON_INTERVAL_MS =
655        NM_PREFIX + "container-monitor.interval-ms";
656      public final static int DEFAULT_NM_CONTAINER_MON_INTERVAL_MS = 3000;
657    
658      /** Class that calculates containers current resource utilization.*/
659      public static final String NM_CONTAINER_MON_RESOURCE_CALCULATOR =
660        NM_PREFIX + "container-monitor.resource-calculator.class";
661      /** Class that calculates process tree resource utilization.*/
662      public static final String NM_CONTAINER_MON_PROCESS_TREE =
663        NM_PREFIX + "container-monitor.process-tree.class";
664    
665      /**
666       * Enable/Disable disks' health checker. Default is true.
667       * An expert level configuration property.
668       */
669      public static final String NM_DISK_HEALTH_CHECK_ENABLE =
670        NM_PREFIX + "disk-health-checker.enable";
671      /** Frequency of running disks' health checker.*/
672      public static final String NM_DISK_HEALTH_CHECK_INTERVAL_MS =
673        NM_PREFIX + "disk-health-checker.interval-ms";
674      /** By default, disks' health is checked every 2 minutes. */
675      public static final long DEFAULT_NM_DISK_HEALTH_CHECK_INTERVAL_MS =
676        2 * 60 * 1000;
677    
678      /**
679       * The minimum fraction of number of disks to be healthy for the nodemanager
680       * to launch new containers. This applies to nm-local-dirs and nm-log-dirs.
681       */
682      public static final String NM_MIN_HEALTHY_DISKS_FRACTION =
683        NM_PREFIX + "disk-health-checker.min-healthy-disks";
684      /**
685       * By default, at least 5% of disks are to be healthy to say that the node
686       * is healthy in terms of disks.
687       */
688      public static final float DEFAULT_NM_MIN_HEALTHY_DISKS_FRACTION
689        = 0.25F;
690    
691      /** Frequency of running node health script.*/
692      public static final String NM_HEALTH_CHECK_INTERVAL_MS = 
693        NM_PREFIX + "health-checker.interval-ms";
694      public static final long DEFAULT_NM_HEALTH_CHECK_INTERVAL_MS = 10 * 60 * 1000;
695    
696      /** Health check script time out period.*/  
697      public static final String NM_HEALTH_CHECK_SCRIPT_TIMEOUT_MS = 
698        NM_PREFIX + "health-checker.script.timeout-ms";
699      public static final long DEFAULT_NM_HEALTH_CHECK_SCRIPT_TIMEOUT_MS = 
700        2 * DEFAULT_NM_HEALTH_CHECK_INTERVAL_MS;
701      
702      /** The health check script to run.*/
703      public static final String NM_HEALTH_CHECK_SCRIPT_PATH = 
704        NM_PREFIX + "health-checker.script.path";
705      
706      /** The arguments to pass to the health check script.*/
707      public static final String NM_HEALTH_CHECK_SCRIPT_OPTS = 
708        NM_PREFIX + "health-checker.script.opts";
709      
710      /** The path to the Linux container executor.*/
711      public static final String NM_LINUX_CONTAINER_EXECUTOR_PATH =
712        NM_PREFIX + "linux-container-executor.path";
713      
714      /** 
715       * The UNIX group that the linux-container-executor should run as.
716       * This is intended to be set as part of container-executor.cfg. 
717       */
718      public static final String NM_LINUX_CONTAINER_GROUP =
719        NM_PREFIX + "linux-container-executor.group";
720    
721      /**
722       * The UNIX user that containers will run as when Linux-container-executor
723       * is used in nonsecure mode (a use case for this is using cgroups).
724       */
725      public static final String NM_NONSECURE_MODE_LOCAL_USER_KEY = NM_PREFIX +
726          "linux-container-executor.nonsecure-mode.local-user";
727    
728      public static final String DEFAULT_NM_NONSECURE_MODE_LOCAL_USER = "nobody";
729    
730      /**
731       * The allowed pattern for UNIX user names enforced by 
732       * Linux-container-executor when used in nonsecure mode (use case for this 
733       * is using cgroups). The default value is taken from /usr/sbin/adduser
734       */
735      public static final String NM_NONSECURE_MODE_USER_PATTERN_KEY = NM_PREFIX +
736          "linux-container-executor.nonsecure-mode.user-pattern";
737    
738      public static final String DEFAULT_NM_NONSECURE_MODE_USER_PATTERN = 
739          "^[_.A-Za-z0-9][-@_.A-Za-z0-9]{0,255}?[$]?$";
740    
741      /** The type of resource enforcement to use with the
742       *  linux container executor.
743       */
744      public static final String NM_LINUX_CONTAINER_RESOURCES_HANDLER = 
745      NM_PREFIX + "linux-container-executor.resources-handler.class";
746      
747      /** The path the linux container executor should use for cgroups */
748      public static final String NM_LINUX_CONTAINER_CGROUPS_HIERARCHY =
749        NM_PREFIX + "linux-container-executor.cgroups.hierarchy";
750      
751      /** Whether the linux container executor should mount cgroups if not found */
752      public static final String NM_LINUX_CONTAINER_CGROUPS_MOUNT =
753        NM_PREFIX + "linux-container-executor.cgroups.mount";
754      
755      /** Where the linux container executor should mount cgroups if not found */
756      public static final String NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH =
757        NM_PREFIX + "linux-container-executor.cgroups.mount-path";
758    
759    
760      /**
761       * Interval of time the linux container executor should try cleaning up
762       * cgroups entry when cleaning up a container. This is required due to what 
763       * it seems a race condition because the SIGTERM/SIGKILL is asynch.
764       */
765      public static final String NM_LINUX_CONTAINER_CGROUPS_DELETE_TIMEOUT =
766       NM_PREFIX + "linux-container-executor.cgroups.delete-timeout-ms";
767    
768      public static final long DEFAULT_NM_LINUX_CONTAINER_CGROUPS_DELETE_TIMEOUT =
769          1000;
770    
771      /** T-file compression types used to compress aggregated logs.*/
772      public static final String NM_LOG_AGG_COMPRESSION_TYPE = 
773        NM_PREFIX + "log-aggregation.compression-type";
774      public static final String DEFAULT_NM_LOG_AGG_COMPRESSION_TYPE = "none";
775      
776      /** The kerberos principal for the node manager.*/
777      public static final String NM_PRINCIPAL =
778        NM_PREFIX + "principal";
779      
780      public static final String NM_AUX_SERVICES = 
781        NM_PREFIX + "aux-services";
782      
783      public static final String NM_AUX_SERVICE_FMT =
784        NM_PREFIX + "aux-services.%s.class";
785    
786      public static final String NM_USER_HOME_DIR =
787          NM_PREFIX + "user-home-dir";
788      
789      /**The kerberos principal to be used for spnego filter for NM.*/
790      public static final String NM_WEBAPP_SPNEGO_USER_NAME_KEY =
791          NM_PREFIX + "webapp.spnego-principal";
792      
793      /**The kerberos keytab to be used for spnego filter for NM.*/
794      public static final String NM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY =
795          NM_PREFIX + "webapp.spnego-keytab-file";
796      
797      public static final String DEFAULT_NM_USER_HOME_DIR= "/home/";
798    
799      ////////////////////////////////
800      // Web Proxy Configs
801      ////////////////////////////////
802      public static final String PROXY_PREFIX = "yarn.web-proxy.";
803      
804      /** The kerberos principal for the proxy.*/
805      public static final String PROXY_PRINCIPAL =
806        PROXY_PREFIX + "principal";
807      
808      /** Keytab for Proxy.*/
809      public static final String PROXY_KEYTAB = PROXY_PREFIX + "keytab";
810      
811      /** The address for the web proxy.*/
812      public static final String PROXY_ADDRESS =
813        PROXY_PREFIX + "address";
814      
815      /**
816       * YARN Service Level Authorization
817       */
818      public static final String 
819      YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCETRACKER_PROTOCOL =
820          "security.resourcetracker.protocol.acl";
821      public static final String 
822      YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONCLIENT_PROTOCOL =
823          "security.applicationclient.protocol.acl";
824      public static final String 
825      YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCEMANAGER_ADMINISTRATION_PROTOCOL =
826          "security.resourcemanager-administration.protocol.acl";
827      public static final String 
828      YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONMASTER_PROTOCOL =
829          "security.applicationmaster.protocol.acl";
830    
831      public static final String 
832      YARN_SECURITY_SERVICE_AUTHORIZATION_CONTAINER_MANAGEMENT_PROTOCOL =
833          "security.containermanagement.protocol.acl";
834      public static final String 
835      YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCE_LOCALIZER =
836          "security.resourcelocalizer.protocol.acl";
837    
838      /** No. of milliseconds to wait between sending a SIGTERM and SIGKILL
839       * to a running container */
840      public static final String NM_SLEEP_DELAY_BEFORE_SIGKILL_MS =
841          NM_PREFIX + "sleep-delay-before-sigkill.ms";
842      public static final long DEFAULT_NM_SLEEP_DELAY_BEFORE_SIGKILL_MS =
843          250;
844    
845      /** Max time to wait for a process to come up when trying to cleanup
846       * container resources */
847      public static final String NM_PROCESS_KILL_WAIT_MS =
848          NM_PREFIX + "process-kill-wait.ms";
849      public static final long DEFAULT_NM_PROCESS_KILL_WAIT_MS =
850          2000;
851    
852      /** Max time to wait to establish a connection to RM */
853      public static final String RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
854          RM_PREFIX + "connect.max-wait.ms";
855      public static final int DEFAULT_RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
856          15 * 60 * 1000;
857    
858      /** Time interval between each attempt to connect to RM */
859      public static final String RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS =
860          RM_PREFIX + "connect.retry-interval.ms";
861      public static final long DEFAULT_RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS
862          = 30 * 1000;
863    
864      /**
865       * CLASSPATH for YARN applications. A comma-separated list of CLASSPATH
866       * entries
867       */
868      public static final String YARN_APPLICATION_CLASSPATH = YARN_PREFIX
869          + "application.classpath";
870    
871      /**
872       * Default CLASSPATH for YARN applications. A comma-separated list of
873       * CLASSPATH entries
874       */
875      public static final String[] DEFAULT_YARN_APPLICATION_CLASSPATH = {
876          ApplicationConstants.Environment.HADOOP_CONF_DIR.$(),
877          ApplicationConstants.Environment.HADOOP_COMMON_HOME.$()
878              + "/share/hadoop/common/*",
879          ApplicationConstants.Environment.HADOOP_COMMON_HOME.$()
880              + "/share/hadoop/common/lib/*",
881          ApplicationConstants.Environment.HADOOP_HDFS_HOME.$()
882              + "/share/hadoop/hdfs/*",
883          ApplicationConstants.Environment.HADOOP_HDFS_HOME.$()
884              + "/share/hadoop/hdfs/lib/*",
885          ApplicationConstants.Environment.HADOOP_YARN_HOME.$()
886              + "/share/hadoop/yarn/*",
887          ApplicationConstants.Environment.HADOOP_YARN_HOME.$()
888              + "/share/hadoop/yarn/lib/*" };
889    
890      /** Container temp directory */
891      public static final String DEFAULT_CONTAINER_TEMP_DIR = "./tmp";
892    
893      public static final String IS_MINI_YARN_CLUSTER = YARN_PREFIX
894          + "is.minicluster";
895    
896      public static final String YARN_MC_PREFIX = YARN_PREFIX + "minicluster.";
897    
898      /** Whether to use fixed ports with the minicluster. */
899      public static final String YARN_MINICLUSTER_FIXED_PORTS =
900          YARN_MC_PREFIX + "fixed.ports";
901    
902      /**
903       * Default is false to be able to run tests concurrently without port
904       * conflicts.
905       */
906      public static final boolean DEFAULT_YARN_MINICLUSTER_FIXED_PORTS = false;
907    
908      /**
909       * Whether the NM should use RPC to connect to the RM. Default is false.
910       * Can be set to true only when using fixed ports.
911       */
912      public static final String YARN_MINICLUSTER_USE_RPC = YARN_MC_PREFIX + "use-rpc";
913      public static final boolean DEFAULT_YARN_MINICLUSTER_USE_RPC = false;
914    
915      /**
916       * Whether users are explicitly trying to control resource monitoring
917       * configuration for the MiniYARNCluster. Disabled by default.
918       */
919      public static final String YARN_MINICLUSTER_CONTROL_RESOURCE_MONITORING =
920          YARN_MC_PREFIX + "control-resource-monitoring";
921      public static final boolean
922          DEFAULT_YARN_MINICLUSTER_CONTROL_RESOURCE_MONITORING = false;
923    
924      /** The log directory for the containers */
925      public static final String YARN_APP_CONTAINER_LOG_DIR =
926          YARN_PREFIX + "app.container.log.dir";
927    
928      public static final String YARN_APP_CONTAINER_LOG_SIZE =
929          YARN_PREFIX + "app.container.log.filesize";
930    
931      public static final String YARN_APP_CONTAINER_LOG_BACKUPS =
932          YARN_PREFIX + "app.container.log.backups";
933    
934      ////////////////////////////////
935      // Other Configs
936      ////////////////////////////////
937    
938      /**
939       * Use YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS instead.
940       * The interval of the yarn client's querying application state after
941       * application submission. The unit is millisecond.
942       */
943      @Deprecated
944      public static final String YARN_CLIENT_APP_SUBMISSION_POLL_INTERVAL_MS =
945          YARN_PREFIX + "client.app-submission.poll-interval";
946    
947      /**
948       * The interval that the yarn client library uses to poll the completion
949       * status of the asynchronous API of application client protocol.
950       */
951      public static final String YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS =
952          YARN_PREFIX + "client.application-client-protocol.poll-interval-ms";
953      public static final long DEFAULT_YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS =
954          200;
955    
956      /**
957       * The duration that the yarn client library waits, cumulatively across polls,
958       * for an expected state change to occur. Defaults to -1, which indicates no
959       * limit.
960       */
961      public static final String YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_TIMEOUT_MS =
962          YARN_PREFIX + "client.application-client-protocol.poll-timeout-ms";
963      public static final long DEFAULT_YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_TIMEOUT_MS =
964          -1;
965    
966      /**
967       * Max number of threads in NMClientAsync to process container management
968       * events
969       */
970      public static final String NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE =
971          YARN_PREFIX + "client.nodemanager-client-async.thread-pool-max-size";
972      public static final int DEFAULT_NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE = 500;
973    
974      /**
975       * Maximum number of proxy connections for node manager. It should always be
976       * more than 1. NMClient and MRAppMaster will use this to cache connection
977       * with node manager. There will be at max one connection per node manager.
978       * Ex. configuring it to a value of 5 will make sure that client will at
979       * max have 5 connections cached with 5 different node managers. These
980       * connections will be timed out if idle for more than system wide idle
981       * timeout period. The token if used for authentication then it will be used
982       * only at connection creation time. If new token is received then earlier
983       * connection should be closed in order to use newer token.
984       * Note: {@link YarnConfiguration#NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE}
985       * are related to each other.
986       */
987      public static final String NM_CLIENT_MAX_NM_PROXIES =
988          YARN_PREFIX + "client.max-nodemanagers-proxies";
989      public static final int DEFAULT_NM_CLIENT_MAX_NM_PROXIES = 500;
990    
991      public static final String YARN_HTTP_POLICY_KEY =
992              YARN_PREFIX + "http.policy";
993      public static final String YARN_HTTP_POLICY_DEFAULT =
994              CommonConfigurationKeysPublic.HTTP_POLICY_HTTP_ONLY;
995    
996      public YarnConfiguration() {
997        super();
998      }
999      
1000      public YarnConfiguration(Configuration conf) {
1001        super(conf);
1002        if (! (conf instanceof YarnConfiguration)) {
1003          this.reloadConfiguration();
1004        }
1005      }
1006    
1007      /**
1008       * Get the socket address for <code>name</code> property as a
1009       * <code>InetSocketAddress</code>.
1010       * @param name property name.
1011       * @param defaultAddress the default value
1012       * @param defaultPort the default port
1013       * @return InetSocketAddress
1014       */
1015      @Override
1016      public InetSocketAddress getSocketAddr(
1017          String name, String defaultAddress, int defaultPort) {
1018        String address;
1019        if (HAUtil.isHAEnabled(this) && RM_SERVICES_ADDRESS_CONF_KEYS.contains(name)) {
1020          address = HAUtil.getConfValueForRMInstance(name, defaultAddress, this);
1021        } else {
1022          address = get(name, defaultAddress);
1023        }
1024        return NetUtils.createSocketAddr(address, defaultPort, name);
1025      }
1026    
1027      @Override
1028      public InetSocketAddress updateConnectAddr(String name,
1029                                                 InetSocketAddress addr) {
1030        String prefix = name;
1031        if (HAUtil.isHAEnabled(this)) {
1032          prefix = HAUtil.addSuffix(prefix, HAUtil.getRMHAId(this));
1033        }
1034        return super.updateConnectAddr(prefix, addr);
1035      }
1036    }