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
019package org.apache.hadoop.yarn.conf;
020
021import java.net.InetSocketAddress;
022import java.util.Arrays;
023import java.util.Collections;
024import java.util.List;
025
026import org.apache.hadoop.HadoopIllegalArgumentException;
027import org.apache.hadoop.classification.InterfaceAudience.Private;
028import org.apache.hadoop.classification.InterfaceAudience.Public;
029import org.apache.hadoop.classification.InterfaceStability.Evolving;
030import org.apache.hadoop.classification.InterfaceStability.Unstable;
031import org.apache.hadoop.conf.Configuration;
032import org.apache.hadoop.http.HttpConfig;
033import org.apache.hadoop.net.NetUtils;
034import org.apache.hadoop.util.StringUtils;
035import org.apache.hadoop.yarn.api.ApplicationConstants;
036
037@Public
038@Evolving
039public class YarnConfiguration extends Configuration {
040
041  @Private
042  public static final String CS_CONFIGURATION_FILE= "capacity-scheduler.xml";
043
044  @Private
045  public static final String HADOOP_POLICY_CONFIGURATION_FILE =
046      "hadoop-policy.xml";
047
048  @Private
049  public static final String YARN_SITE_CONFIGURATION_FILE = "yarn-site.xml";
050
051  private static final String YARN_DEFAULT_CONFIGURATION_FILE =
052      "yarn-default.xml";
053
054  @Private
055  public static final String CORE_SITE_CONFIGURATION_FILE = "core-site.xml";
056
057  @Private
058  public static final List<String> RM_CONFIGURATION_FILES =
059      Collections.unmodifiableList(Arrays.asList(
060          CS_CONFIGURATION_FILE,
061          HADOOP_POLICY_CONFIGURATION_FILE,
062          YARN_SITE_CONFIGURATION_FILE,
063          CORE_SITE_CONFIGURATION_FILE));
064
065  @Evolving
066  public static final int APPLICATION_MAX_TAGS = 10;
067
068  @Evolving
069  public static final int APPLICATION_MAX_TAG_LENGTH = 100;
070
071  static {
072    addDeprecatedKeys();
073    Configuration.addDefaultResource(YARN_DEFAULT_CONFIGURATION_FILE);
074    Configuration.addDefaultResource(YARN_SITE_CONFIGURATION_FILE);
075  }
076
077  private static void addDeprecatedKeys() {
078    Configuration.addDeprecations(new DeprecationDelta[] {
079        new DeprecationDelta("yarn.client.max-nodemanagers-proxies",
080            NM_CLIENT_MAX_NM_PROXIES)
081    });
082  }
083
084  //Configurations
085
086  public static final String YARN_PREFIX = "yarn.";
087
088  /** Delay before deleting resource to ease debugging of NM issues */
089  public static final String DEBUG_NM_DELETE_DELAY_SEC =
090    YarnConfiguration.NM_PREFIX + "delete.debug-delay-sec";
091  
092  ////////////////////////////////
093  // IPC Configs
094  ////////////////////////////////
095  public static final String IPC_PREFIX = YARN_PREFIX + "ipc.";
096
097  /** Factory to create client IPC classes.*/
098  public static final String IPC_CLIENT_FACTORY_CLASS =
099    IPC_PREFIX + "client.factory.class";
100  public static final String DEFAULT_IPC_CLIENT_FACTORY_CLASS = 
101      "org.apache.hadoop.yarn.factories.impl.pb.RpcClientFactoryPBImpl";
102
103  /** Factory to create server IPC classes.*/
104  public static final String IPC_SERVER_FACTORY_CLASS = 
105    IPC_PREFIX + "server.factory.class";
106  public static final String DEFAULT_IPC_SERVER_FACTORY_CLASS = 
107      "org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl";
108
109  /** Factory to create serializeable records.*/
110  public static final String IPC_RECORD_FACTORY_CLASS = 
111    IPC_PREFIX + "record.factory.class";
112  public static final String DEFAULT_IPC_RECORD_FACTORY_CLASS = 
113      "org.apache.hadoop.yarn.factories.impl.pb.RecordFactoryPBImpl";
114
115  /** RPC class implementation*/
116  public static final String IPC_RPC_IMPL =
117    IPC_PREFIX + "rpc.class";
118  public static final String DEFAULT_IPC_RPC_IMPL = 
119    "org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC";
120  
121  ////////////////////////////////
122  // Resource Manager Configs
123  ////////////////////////////////
124  public static final String RM_PREFIX = "yarn.resourcemanager.";
125
126  public static final String RM_CLUSTER_ID = RM_PREFIX + "cluster-id";
127
128  public static final String RM_HOSTNAME = RM_PREFIX + "hostname";
129
130  /** The address of the applications manager interface in the RM.*/
131  public static final String RM_ADDRESS = 
132    RM_PREFIX + "address";
133  public static final int DEFAULT_RM_PORT = 8032;
134  public static final String DEFAULT_RM_ADDRESS =
135    "0.0.0.0:" + DEFAULT_RM_PORT;
136
137  /** The actual bind address for the RM.*/
138  public static final String RM_BIND_HOST =
139    RM_PREFIX + "bind-host";
140
141  /** The number of threads used to handle applications manager requests.*/
142  public static final String RM_CLIENT_THREAD_COUNT =
143    RM_PREFIX + "client.thread-count";
144  public static final int DEFAULT_RM_CLIENT_THREAD_COUNT = 50;
145
146  /** Number of threads used to launch/cleanup AM.*/
147  public static final String RM_AMLAUNCHER_THREAD_COUNT =
148      RM_PREFIX + "amlauncher.thread-count";
149  public static final int DEFAULT_RM_AMLAUNCHER_THREAD_COUNT = 50;
150
151  /** Retry times to connect with NM.*/
152  public static final String RM_NODEMANAGER_CONNECT_RETIRES =
153      RM_PREFIX + "nodemanager-connect-retries";
154  public static final int DEFAULT_RM_NODEMANAGER_CONNECT_RETIRES = 10;
155
156  /** The Kerberos principal for the resource manager.*/
157  public static final String RM_PRINCIPAL =
158    RM_PREFIX + "principal";
159  
160  /** The address of the scheduler interface.*/
161  public static final String RM_SCHEDULER_ADDRESS = 
162    RM_PREFIX + "scheduler.address";
163  public static final int DEFAULT_RM_SCHEDULER_PORT = 8030;
164  public static final String DEFAULT_RM_SCHEDULER_ADDRESS = "0.0.0.0:" +
165    DEFAULT_RM_SCHEDULER_PORT;
166
167  /** Miniumum request grant-able by the RM scheduler. */
168  public static final String RM_SCHEDULER_MINIMUM_ALLOCATION_MB =
169    YARN_PREFIX + "scheduler.minimum-allocation-mb";
170  public static final int DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB = 1024;
171  public static final String RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES =
172      YARN_PREFIX + "scheduler.minimum-allocation-vcores";
173    public static final int DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES = 1;
174
175  /** Maximum request grant-able by the RM scheduler. */
176  public static final String RM_SCHEDULER_MAXIMUM_ALLOCATION_MB =
177    YARN_PREFIX + "scheduler.maximum-allocation-mb";
178  public static final int DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB = 8192;
179  public static final String RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES =
180      YARN_PREFIX + "scheduler.maximum-allocation-vcores";
181  public static final int DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES = 4;
182
183  /** Number of threads to handle scheduler interface.*/
184  public static final String RM_SCHEDULER_CLIENT_THREAD_COUNT =
185    RM_PREFIX + "scheduler.client.thread-count";
186  public static final int DEFAULT_RM_SCHEDULER_CLIENT_THREAD_COUNT = 50;
187
188  /** If the port should be included or not in the node name. The node name
189   * is used by the scheduler for resource requests allocation location 
190   * matching. Typically this is just the hostname, using the port is needed
191   * when using minicluster and specific NM are required.*/
192  public static final String RM_SCHEDULER_INCLUDE_PORT_IN_NODE_NAME =
193      YARN_PREFIX + "scheduler.include-port-in-node-name";
194  public static final boolean DEFAULT_RM_SCHEDULER_USE_PORT_FOR_NODE_NAME = 
195      false;
196
197  /** Enable Resource Manager webapp ui actions */
198  public static final String RM_WEBAPP_UI_ACTIONS_ENABLED =
199    RM_PREFIX + "webapp.ui-actions.enabled";
200  public static final boolean DEFAULT_RM_WEBAPP_UI_ACTIONS_ENABLED =
201    true;
202
203  /** Whether the RM should enable Reservation System */
204  public static final String RM_RESERVATION_SYSTEM_ENABLE = RM_PREFIX
205      + "reservation-system.enable";
206  public static final boolean DEFAULT_RM_RESERVATION_SYSTEM_ENABLE = false;
207
208  /** The class to use as the Reservation System. */
209  public static final String RM_RESERVATION_SYSTEM_CLASS = RM_PREFIX
210      + "reservation-system.class";
211
212  /** The PlanFollower for the Reservation System. */
213  public static final String RM_RESERVATION_SYSTEM_PLAN_FOLLOWER = RM_PREFIX
214      + "reservation-system.plan.follower";
215
216  /** The step size of the Reservation System. */
217  public static final String RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP =
218      RM_PREFIX + "reservation-system.planfollower.time-step";
219  public static final long DEFAULT_RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP =
220      1000L;
221
222  /**
223   * Enable periodic monitor threads.
224   * @see #RM_SCHEDULER_MONITOR_POLICIES
225   */
226  public static final String RM_SCHEDULER_ENABLE_MONITORS =
227    RM_PREFIX + "scheduler.monitor.enable";
228  public static final boolean DEFAULT_RM_SCHEDULER_ENABLE_MONITORS = false;
229
230  /** List of SchedulingEditPolicy classes affecting the scheduler. */
231  public static final String RM_SCHEDULER_MONITOR_POLICIES =
232    RM_PREFIX + "scheduler.monitor.policies";
233
234  /** The address of the RM web application.*/
235  public static final String RM_WEBAPP_ADDRESS = 
236    RM_PREFIX + "webapp.address";
237
238  public static final int DEFAULT_RM_WEBAPP_PORT = 8088;
239  public static final String DEFAULT_RM_WEBAPP_ADDRESS = "0.0.0.0:" +
240    DEFAULT_RM_WEBAPP_PORT;
241  
242  /** The https address of the RM web application.*/
243  public static final String RM_WEBAPP_HTTPS_ADDRESS =
244      RM_PREFIX + "webapp.https.address";
245  public static final boolean YARN_SSL_CLIENT_HTTPS_NEED_AUTH_DEFAULT = false;
246  public static final String YARN_SSL_SERVER_RESOURCE_DEFAULT = "ssl-server.xml";
247  
248  public static final int DEFAULT_RM_WEBAPP_HTTPS_PORT = 8090;
249  public static final String DEFAULT_RM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
250      + DEFAULT_RM_WEBAPP_HTTPS_PORT;
251  
252  public static final String RM_RESOURCE_TRACKER_ADDRESS =
253    RM_PREFIX + "resource-tracker.address";
254  public static final int DEFAULT_RM_RESOURCE_TRACKER_PORT = 8031;
255  public static final String DEFAULT_RM_RESOURCE_TRACKER_ADDRESS =
256    "0.0.0.0:" + DEFAULT_RM_RESOURCE_TRACKER_PORT;
257
258  /** The expiry interval for application master reporting.*/
259  public static final String RM_AM_EXPIRY_INTERVAL_MS = 
260    YARN_PREFIX  + "am.liveness-monitor.expiry-interval-ms";
261  public static final int DEFAULT_RM_AM_EXPIRY_INTERVAL_MS = 600000;
262
263  /** How long to wait until a node manager is considered dead.*/
264  public static final String RM_NM_EXPIRY_INTERVAL_MS = 
265    YARN_PREFIX + "nm.liveness-monitor.expiry-interval-ms";
266  public static final int DEFAULT_RM_NM_EXPIRY_INTERVAL_MS = 600000;
267
268  /** Are acls enabled.*/
269  public static final String YARN_ACL_ENABLE = 
270    YARN_PREFIX + "acl.enable";
271  public static final boolean DEFAULT_YARN_ACL_ENABLE = false;
272  
273  /** ACL of who can be admin of YARN cluster.*/
274  public static final String YARN_ADMIN_ACL = 
275    YARN_PREFIX + "admin.acl";
276  public static final String DEFAULT_YARN_ADMIN_ACL = "*";
277  
278  /** ACL used in case none is found. Allows nothing. */
279  public static final String DEFAULT_YARN_APP_ACL = " ";
280
281  /**
282   * Enable/disable intermediate-data encryption at YARN level. For now, this
283   * only is used by the FileSystemRMStateStore to setup right file-system
284   * security attributes.
285   */
286  @Private
287  public static final String YARN_INTERMEDIATE_DATA_ENCRYPTION = YARN_PREFIX
288      + "intermediate-data-encryption.enable";
289
290  @Private
291  public static final Boolean DEFAULT_YARN_INTERMEDIATE_DATA_ENCRYPTION = false;
292
293  /** The address of the RM admin interface.*/
294  public static final String RM_ADMIN_ADDRESS = 
295    RM_PREFIX + "admin.address";
296  public static final int DEFAULT_RM_ADMIN_PORT = 8033;
297  public static final String DEFAULT_RM_ADMIN_ADDRESS = "0.0.0.0:" +
298      DEFAULT_RM_ADMIN_PORT;
299  
300  /**Number of threads used to handle RM admin interface.*/
301  public static final String RM_ADMIN_CLIENT_THREAD_COUNT =
302    RM_PREFIX + "admin.client.thread-count";
303  public static final int DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT = 1;
304  
305  /**
306   * The maximum number of application attempts.
307   * It's a global setting for all application masters.
308   */
309  public static final String RM_AM_MAX_ATTEMPTS =
310    RM_PREFIX + "am.max-attempts";
311  public static final int DEFAULT_RM_AM_MAX_ATTEMPTS = 2;
312  
313  /** The keytab for the resource manager.*/
314  public static final String RM_KEYTAB = 
315    RM_PREFIX + "keytab";
316
317  /**The kerberos principal to be used for spnego filter for RM.*/
318  public static final String RM_WEBAPP_SPNEGO_USER_NAME_KEY =
319      RM_PREFIX + "webapp.spnego-principal";
320  
321  /**The kerberos keytab to be used for spnego filter for RM.*/
322  public static final String RM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY =
323      RM_PREFIX + "webapp.spnego-keytab-file";
324
325  /**
326   * Flag to enable override of the default kerberos authentication filter with
327   * the RM authentication filter to allow authentication using delegation
328   * tokens(fallback to kerberos if the tokens are missing). Only applicable
329   * when the http authentication type is kerberos.
330   */
331  public static final String RM_WEBAPP_DELEGATION_TOKEN_AUTH_FILTER = RM_PREFIX
332      + "webapp.delegation-token-auth-filter.enabled";
333  public static final boolean DEFAULT_RM_WEBAPP_DELEGATION_TOKEN_AUTH_FILTER =
334      true;
335
336  /** Enable cross origin (CORS) support. **/
337  public static final String RM_WEBAPP_ENABLE_CORS_FILTER =
338      RM_PREFIX + "webapp.cross-origin.enabled";
339  public static final boolean DEFAULT_RM_WEBAPP_ENABLE_CORS_FILTER = false;
340
341  /** How long to wait until a container is considered dead.*/
342  public static final String RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS = 
343    RM_PREFIX + "rm.container-allocation.expiry-interval-ms";
344  public static final int DEFAULT_RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS = 600000;
345  
346  /** Path to file with nodes to include.*/
347  public static final String RM_NODES_INCLUDE_FILE_PATH = 
348    RM_PREFIX + "nodes.include-path";
349  public static final String DEFAULT_RM_NODES_INCLUDE_FILE_PATH = "";
350  
351  /** Path to file with nodes to exclude.*/
352  public static final String RM_NODES_EXCLUDE_FILE_PATH = 
353    RM_PREFIX + "nodes.exclude-path";
354  public static final String DEFAULT_RM_NODES_EXCLUDE_FILE_PATH = "";
355  
356  /** Number of threads to handle resource tracker calls.*/
357  public static final String RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT =
358    RM_PREFIX + "resource-tracker.client.thread-count";
359  public static final int DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT = 50;
360  
361  /** The class to use as the resource scheduler.*/
362  public static final String RM_SCHEDULER = 
363    RM_PREFIX + "scheduler.class";
364 
365  public static final String DEFAULT_RM_SCHEDULER = 
366      "org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler";
367
368  /** RM set next Heartbeat interval for NM */
369  public static final String RM_NM_HEARTBEAT_INTERVAL_MS =
370      RM_PREFIX + "nodemanagers.heartbeat-interval-ms";
371  public static final long DEFAULT_RM_NM_HEARTBEAT_INTERVAL_MS = 1000;
372
373  /** Number of worker threads that write the history data. */
374  public static final String RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE =
375      RM_PREFIX + "history-writer.multi-threaded-dispatcher.pool-size";
376  public static final int DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE =
377      10;
378
379  /**
380   *  The setting that controls whether yarn system metrics is published on the
381   *  timeline server or not by RM.
382   */
383  public static final String RM_SYSTEM_METRICS_PUBLISHER_ENABLED =
384      RM_PREFIX + "system-metrics-publisher.enabled";
385  public static final boolean DEFAULT_RM_SYSTEM_METRICS_PUBLISHER_ENABLED = false;
386
387  public static final String RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE =
388      RM_PREFIX + "system-metrics-publisher.dispatcher.pool-size";
389  public static final int DEFAULT_RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE =
390      10;
391
392  //RM delegation token related keys
393  public static final String RM_DELEGATION_KEY_UPDATE_INTERVAL_KEY =
394    RM_PREFIX + "delegation.key.update-interval";
395  public static final long RM_DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT =
396    24*60*60*1000; // 1 day
397  public static final String RM_DELEGATION_TOKEN_RENEW_INTERVAL_KEY =
398    RM_PREFIX + "delegation.token.renew-interval";
399  public static final long RM_DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT =
400    24*60*60*1000;  // 1 day
401  public static final String RM_DELEGATION_TOKEN_MAX_LIFETIME_KEY =
402     RM_PREFIX + "delegation.token.max-lifetime";
403  public static final long RM_DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT =
404    7*24*60*60*1000; // 7 days
405  
406  public static final String RECOVERY_ENABLED = RM_PREFIX + "recovery.enabled";
407  public static final boolean DEFAULT_RM_RECOVERY_ENABLED = false;
408
409  public static final String YARN_FAIL_FAST = YARN_PREFIX + "fail-fast";
410  public static final boolean DEFAULT_YARN_FAIL_FAST = false;
411
412  public static final String RM_FAIL_FAST = RM_PREFIX + "fail-fast";
413
414  @Private
415  public static final String RM_WORK_PRESERVING_RECOVERY_ENABLED = RM_PREFIX
416      + "work-preserving-recovery.enabled";
417  @Private
418  public static final boolean DEFAULT_RM_WORK_PRESERVING_RECOVERY_ENABLED =
419      true;
420
421  public static final String RM_WORK_PRESERVING_RECOVERY_SCHEDULING_WAIT_MS =
422      RM_PREFIX + "work-preserving-recovery.scheduling-wait-ms";
423  public static final long DEFAULT_RM_WORK_PRESERVING_RECOVERY_SCHEDULING_WAIT_MS =
424      10000;
425
426  /** Zookeeper interaction configs */
427  public static final String RM_ZK_PREFIX = RM_PREFIX + "zk-";
428
429  public static final String RM_ZK_ADDRESS = RM_ZK_PREFIX + "address";
430
431  public static final String RM_ZK_NUM_RETRIES = RM_ZK_PREFIX + "num-retries";
432  public static final int DEFAULT_ZK_RM_NUM_RETRIES = 1000;
433
434  public static final String RM_ZK_RETRY_INTERVAL_MS =
435      RM_ZK_PREFIX + "retry-interval-ms";
436  public static final long DEFAULT_RM_ZK_RETRY_INTERVAL_MS = 1000;
437
438  public static final String RM_ZK_TIMEOUT_MS = RM_ZK_PREFIX + "timeout-ms";
439  public static final int DEFAULT_RM_ZK_TIMEOUT_MS = 10000;
440
441  public static final String RM_ZK_ACL = RM_ZK_PREFIX + "acl";
442  public static final String DEFAULT_RM_ZK_ACL = "world:anyone:rwcda";
443
444  public static final String RM_ZK_AUTH = RM_ZK_PREFIX + "auth";
445
446  public static final String ZK_STATE_STORE_PREFIX =
447      RM_PREFIX + "zk-state-store.";
448
449  /** Parent znode path under which ZKRMStateStore will create znodes */
450  public static final String ZK_RM_STATE_STORE_PARENT_PATH =
451      ZK_STATE_STORE_PREFIX + "parent-path";
452  public static final String DEFAULT_ZK_RM_STATE_STORE_PARENT_PATH = "/rmstore";
453
454  /** Root node ACLs for fencing */
455  public static final String ZK_RM_STATE_STORE_ROOT_NODE_ACL =
456      ZK_STATE_STORE_PREFIX + "root-node.acl";
457
458  /** HA related configs */
459  public static final String RM_HA_PREFIX = RM_PREFIX + "ha.";
460  public static final String RM_HA_ENABLED = RM_HA_PREFIX + "enabled";
461  public static final boolean DEFAULT_RM_HA_ENABLED = false;
462
463  public static final String RM_HA_IDS = RM_HA_PREFIX + "rm-ids";
464  public static final String RM_HA_ID = RM_HA_PREFIX + "id";
465
466  /** Store the related configuration files in File System */
467  public static final String FS_BASED_RM_CONF_STORE = RM_PREFIX
468      + "configuration.file-system-based-store";
469  public static final String DEFAULT_FS_BASED_RM_CONF_STORE = "/yarn/conf";
470
471  public static final String RM_CONFIGURATION_PROVIDER_CLASS = RM_PREFIX
472      + "configuration.provider-class";
473  public static final String DEFAULT_RM_CONFIGURATION_PROVIDER_CLASS =
474      "org.apache.hadoop.yarn.LocalConfigurationProvider";
475
476  public static final String YARN_AUTHORIZATION_PROVIDER = YARN_PREFIX
477      + "authorization-provider";
478  private static final List<String> RM_SERVICES_ADDRESS_CONF_KEYS_HTTP =
479      Collections.unmodifiableList(Arrays.asList(
480          RM_ADDRESS,
481          RM_SCHEDULER_ADDRESS,
482          RM_ADMIN_ADDRESS,
483          RM_RESOURCE_TRACKER_ADDRESS,
484          RM_WEBAPP_ADDRESS));
485
486  private static final List<String> RM_SERVICES_ADDRESS_CONF_KEYS_HTTPS =
487      Collections.unmodifiableList(Arrays.asList(
488          RM_ADDRESS,
489          RM_SCHEDULER_ADDRESS,
490          RM_ADMIN_ADDRESS,
491          RM_RESOURCE_TRACKER_ADDRESS,
492          RM_WEBAPP_HTTPS_ADDRESS));
493
494  public static final String AUTO_FAILOVER_PREFIX =
495      RM_HA_PREFIX + "automatic-failover.";
496
497  public static final String AUTO_FAILOVER_ENABLED =
498      AUTO_FAILOVER_PREFIX + "enabled";
499  public static final boolean DEFAULT_AUTO_FAILOVER_ENABLED = true;
500
501  public static final String AUTO_FAILOVER_EMBEDDED =
502      AUTO_FAILOVER_PREFIX + "embedded";
503  public static final boolean DEFAULT_AUTO_FAILOVER_EMBEDDED = true;
504
505  public static final String AUTO_FAILOVER_ZK_BASE_PATH =
506      AUTO_FAILOVER_PREFIX + "zk-base-path";
507  public static final String DEFAULT_AUTO_FAILOVER_ZK_BASE_PATH =
508      "/yarn-leader-election";
509
510  public static final String CLIENT_FAILOVER_PREFIX =
511      YARN_PREFIX + "client.failover-";
512  public static final String CLIENT_FAILOVER_PROXY_PROVIDER =
513      CLIENT_FAILOVER_PREFIX + "proxy-provider";
514  public static final String DEFAULT_CLIENT_FAILOVER_PROXY_PROVIDER =
515      "org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider";
516
517  public static final String CLIENT_FAILOVER_MAX_ATTEMPTS =
518      CLIENT_FAILOVER_PREFIX + "max-attempts";
519
520  public static final String CLIENT_FAILOVER_SLEEPTIME_BASE_MS =
521      CLIENT_FAILOVER_PREFIX + "sleep-base-ms";
522
523  public static final String CLIENT_FAILOVER_SLEEPTIME_MAX_MS =
524      CLIENT_FAILOVER_PREFIX + "sleep-max-ms";
525
526  public static final String CLIENT_FAILOVER_RETRIES =
527      CLIENT_FAILOVER_PREFIX + "retries";
528  public static final int DEFAULT_CLIENT_FAILOVER_RETRIES = 0;
529
530  public static final String CLIENT_FAILOVER_RETRIES_ON_SOCKET_TIMEOUTS =
531      CLIENT_FAILOVER_PREFIX + "retries-on-socket-timeouts";
532  public static final int
533      DEFAULT_CLIENT_FAILOVER_RETRIES_ON_SOCKET_TIMEOUTS = 0;
534
535  ////////////////////////////////
536  // RM state store configs
537  ////////////////////////////////
538  /** The class to use as the persistent store.*/
539  public static final String RM_STORE = RM_PREFIX + "store.class";
540  
541  /** URI for FileSystemRMStateStore */
542  public static final String FS_RM_STATE_STORE_URI = RM_PREFIX
543      + "fs.state-store.uri";
544  public static final String FS_RM_STATE_STORE_RETRY_POLICY_SPEC = RM_PREFIX
545      + "fs.state-store.retry-policy-spec";
546  public static final String DEFAULT_FS_RM_STATE_STORE_RETRY_POLICY_SPEC =
547      "2000, 500";
548
549  public static final String FS_RM_STATE_STORE_NUM_RETRIES =
550      RM_PREFIX + "fs.state-store.num-retries";
551  public static final int DEFAULT_FS_RM_STATE_STORE_NUM_RETRIES = 0;
552
553  public static final String FS_RM_STATE_STORE_RETRY_INTERVAL_MS =
554      RM_PREFIX + "fs.state-store.retry-interval-ms";
555  public static final long DEFAULT_FS_RM_STATE_STORE_RETRY_INTERVAL_MS =
556      1000L;
557
558  public static final String RM_LEVELDB_STORE_PATH = RM_PREFIX
559      + "leveldb-state-store.path";
560
561  /** The time in seconds between full compactions of the leveldb database.
562   *  Setting the interval to zero disables the full compaction cycles.
563   */
564  public static final String RM_LEVELDB_COMPACTION_INTERVAL_SECS = RM_PREFIX
565      + "leveldb-state-store.compaction-interval-secs";
566  public static final long DEFAULT_RM_LEVELDB_COMPACTION_INTERVAL_SECS = 3600;
567
568  /** The maximum number of completed applications RM keeps. */ 
569  public static final String RM_MAX_COMPLETED_APPLICATIONS =
570    RM_PREFIX + "max-completed-applications";
571  public static final int DEFAULT_RM_MAX_COMPLETED_APPLICATIONS = 10000;
572
573  /**
574   * The maximum number of completed applications RM state store keeps, by
575   * default equals to DEFAULT_RM_MAX_COMPLETED_APPLICATIONS
576   */
577  public static final String RM_STATE_STORE_MAX_COMPLETED_APPLICATIONS =
578      RM_PREFIX + "state-store.max-completed-applications";
579  public static final int DEFAULT_RM_STATE_STORE_MAX_COMPLETED_APPLICATIONS =
580      DEFAULT_RM_MAX_COMPLETED_APPLICATIONS;
581
582  /** Default application name */
583  public static final String DEFAULT_APPLICATION_NAME = "N/A";
584
585  /** Default application type */
586  public static final String DEFAULT_APPLICATION_TYPE = "YARN";
587
588  /** Default application type length */
589  public static final int APPLICATION_TYPE_LENGTH = 20;
590  
591  /** Default queue name */
592  public static final String DEFAULT_QUEUE_NAME = "default";
593
594  /**
595   * Buckets (in minutes) for the number of apps running in each queue.
596   */
597  public static final String RM_METRICS_RUNTIME_BUCKETS =
598    RM_PREFIX + "metrics.runtime.buckets";
599
600  /**
601   * Default sizes of the runtime metric buckets in minutes.
602   */
603  public static final String DEFAULT_RM_METRICS_RUNTIME_BUCKETS = 
604    "60,300,1440";
605
606  public static final String RM_AMRM_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS = RM_PREFIX
607      + "am-rm-tokens.master-key-rolling-interval-secs";
608
609  public static final long DEFAULT_RM_AMRM_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
610      24 * 60 * 60;
611
612  public static final String RM_CONTAINER_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
613      RM_PREFIX + "container-tokens.master-key-rolling-interval-secs";
614
615  public static final long DEFAULT_RM_CONTAINER_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
616      24 * 60 * 60;
617
618  public static final String RM_NMTOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
619      RM_PREFIX + "nm-tokens.master-key-rolling-interval-secs";
620  
621  public static final long DEFAULT_RM_NMTOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
622      24 * 60 * 60;
623
624  public static final String RM_NODEMANAGER_MINIMUM_VERSION =
625      RM_PREFIX + "nodemanager.minimum.version";
626
627  public static final String DEFAULT_RM_NODEMANAGER_MINIMUM_VERSION =
628      "NONE";
629
630  /**
631   * RM proxy users' prefix
632   */
633  public static final String RM_PROXY_USER_PREFIX = RM_PREFIX + "proxyuser.";
634
635  ////////////////////////////////
636  // Node Manager Configs
637  ////////////////////////////////
638  
639  /** Prefix for all node manager configs.*/
640  public static final String NM_PREFIX = "yarn.nodemanager.";
641
642  /** Environment variables that will be sent to containers.*/
643  public static final String NM_ADMIN_USER_ENV = NM_PREFIX + "admin-env";
644  public static final String DEFAULT_NM_ADMIN_USER_ENV = "MALLOC_ARENA_MAX=$MALLOC_ARENA_MAX";
645
646  /** Environment variables that containers may override rather than use NodeManager's default.*/
647  public static final String NM_ENV_WHITELIST = NM_PREFIX + "env-whitelist";
648  public static final String DEFAULT_NM_ENV_WHITELIST = StringUtils.join(",",
649    Arrays.asList(ApplicationConstants.Environment.JAVA_HOME.key(),
650      ApplicationConstants.Environment.HADOOP_COMMON_HOME.key(),
651      ApplicationConstants.Environment.HADOOP_HDFS_HOME.key(),
652      ApplicationConstants.Environment.HADOOP_CONF_DIR.key(),
653      ApplicationConstants.Environment.CLASSPATH_PREPEND_DISTCACHE.key(),
654      ApplicationConstants.Environment.HADOOP_YARN_HOME.key()));
655  
656  /** address of node manager IPC.*/
657  public static final String NM_ADDRESS = NM_PREFIX + "address";
658  public static final int DEFAULT_NM_PORT = 0;
659  public static final String DEFAULT_NM_ADDRESS = "0.0.0.0:"
660      + DEFAULT_NM_PORT;
661  
662  /** The actual bind address or the NM.*/
663  public static final String NM_BIND_HOST =
664    NM_PREFIX + "bind-host";
665
666  /** who will execute(launch) the containers.*/
667  public static final String NM_CONTAINER_EXECUTOR = 
668    NM_PREFIX + "container-executor.class";
669
670  /**  
671   * Adjustment to make to the container os scheduling priority.
672   * The valid values for this could vary depending on the platform.
673   * On Linux, higher values mean run the containers at a less 
674   * favorable priority than the NM. 
675   * The value specified is an int.
676   */
677  public static final String NM_CONTAINER_EXECUTOR_SCHED_PRIORITY = 
678    NM_PREFIX + "container-executor.os.sched.priority.adjustment";
679  public static final int DEFAULT_NM_CONTAINER_EXECUTOR_SCHED_PRIORITY = 0;
680  
681  /** Number of threads container manager uses.*/
682  public static final String NM_CONTAINER_MGR_THREAD_COUNT =
683    NM_PREFIX + "container-manager.thread-count";
684  public static final int DEFAULT_NM_CONTAINER_MGR_THREAD_COUNT = 20;
685  
686  /** Number of threads used in cleanup.*/
687  public static final String NM_DELETE_THREAD_COUNT = 
688    NM_PREFIX +  "delete.thread-count";
689  public static final int DEFAULT_NM_DELETE_THREAD_COUNT = 4;
690  
691  /** Keytab for NM.*/
692  public static final String NM_KEYTAB = NM_PREFIX + "keytab";
693  
694  /**List of directories to store localized files in.*/
695  public static final String NM_LOCAL_DIRS = NM_PREFIX + "local-dirs";
696  public static final String DEFAULT_NM_LOCAL_DIRS = "/tmp/nm-local-dir";
697
698  /**
699   * Number of files in each localized directories
700   * Avoid tuning this too low. 
701   */
702  public static final String NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY =
703    NM_PREFIX + "local-cache.max-files-per-directory";
704  public static final int DEFAULT_NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY = 8192;
705
706  /** Address where the localizer IPC is.*/
707  public static final String NM_LOCALIZER_ADDRESS =
708    NM_PREFIX + "localizer.address";
709  public static final int DEFAULT_NM_LOCALIZER_PORT = 8040;
710  public static final String DEFAULT_NM_LOCALIZER_ADDRESS = "0.0.0.0:" +
711    DEFAULT_NM_LOCALIZER_PORT;
712  
713  /** Interval in between cache cleanups.*/
714  public static final String NM_LOCALIZER_CACHE_CLEANUP_INTERVAL_MS =
715    NM_PREFIX + "localizer.cache.cleanup.interval-ms";
716  public static final long DEFAULT_NM_LOCALIZER_CACHE_CLEANUP_INTERVAL_MS = 
717    10 * 60 * 1000;
718  
719  /**
720   * Target size of localizer cache in MB, per nodemanager. It is a target
721   * retention size that only includes resources with PUBLIC and PRIVATE
722   * visibility and excludes resources with APPLICATION visibility
723   */
724  public static final String NM_LOCALIZER_CACHE_TARGET_SIZE_MB =
725    NM_PREFIX + "localizer.cache.target-size-mb";
726  public static final long DEFAULT_NM_LOCALIZER_CACHE_TARGET_SIZE_MB = 10 * 1024;
727  
728  /** Number of threads to handle localization requests.*/
729  public static final String NM_LOCALIZER_CLIENT_THREAD_COUNT =
730    NM_PREFIX + "localizer.client.thread-count";
731  public static final int DEFAULT_NM_LOCALIZER_CLIENT_THREAD_COUNT = 5;
732  
733  /** Number of threads to use for localization fetching.*/
734  public static final String NM_LOCALIZER_FETCH_THREAD_COUNT = 
735    NM_PREFIX + "localizer.fetch.thread-count";
736  public static final int DEFAULT_NM_LOCALIZER_FETCH_THREAD_COUNT = 4;
737
738  /** Where to store container logs.*/
739  public static final String NM_LOG_DIRS = NM_PREFIX + "log-dirs";
740  public static final String DEFAULT_NM_LOG_DIRS = "/tmp/logs";
741
742  public static final String NM_RESOURCEMANAGER_MINIMUM_VERSION =
743      NM_PREFIX + "resourcemanager.minimum.version";
744  public static final String DEFAULT_NM_RESOURCEMANAGER_MINIMUM_VERSION = "NONE";
745
746  /** Interval at which the delayed token removal thread runs */
747  public static final String RM_DELAYED_DELEGATION_TOKEN_REMOVAL_INTERVAL_MS =
748      RM_PREFIX + "delayed.delegation-token.removal-interval-ms";
749  public static final long DEFAULT_RM_DELAYED_DELEGATION_TOKEN_REMOVAL_INTERVAL_MS =
750      30000l;
751  
752  /** Delegation Token renewer thread count */
753  public static final String RM_DELEGATION_TOKEN_RENEWER_THREAD_COUNT =
754      RM_PREFIX + "delegation-token-renewer.thread-count";
755  public static final int DEFAULT_RM_DELEGATION_TOKEN_RENEWER_THREAD_COUNT = 50;
756
757  public static final String RM_PROXY_USER_PRIVILEGES_ENABLED = RM_PREFIX
758      + "proxy-user-privileges.enabled";
759  public static boolean DEFAULT_RM_PROXY_USER_PRIVILEGES_ENABLED = false;
760
761  /** Whether to enable log aggregation */
762  public static final String LOG_AGGREGATION_ENABLED = YARN_PREFIX
763      + "log-aggregation-enable";
764  public static final boolean DEFAULT_LOG_AGGREGATION_ENABLED = false;
765  
766  /** 
767   * How long to wait before deleting aggregated logs, -1 disables.
768   * Be careful set this too small and you will spam the name node.
769   */
770  public static final String LOG_AGGREGATION_RETAIN_SECONDS = YARN_PREFIX
771      + "log-aggregation.retain-seconds";
772  public static final long DEFAULT_LOG_AGGREGATION_RETAIN_SECONDS = -1;
773  
774  /**
775   * How long to wait between aggregated log retention checks. If set to
776   * a value {@literal <=} 0 then the value is computed as one-tenth of the
777   * log retention setting. Be careful set this too small and you will spam
778   * the name node.
779   */
780  public static final String LOG_AGGREGATION_RETAIN_CHECK_INTERVAL_SECONDS =
781      YARN_PREFIX + "log-aggregation.retain-check-interval-seconds";
782  public static final long DEFAULT_LOG_AGGREGATION_RETAIN_CHECK_INTERVAL_SECONDS = -1;
783
784  /**
785   * Number of seconds to retain logs on the NodeManager. Only applicable if Log
786   * aggregation is disabled
787   */
788  public static final String NM_LOG_RETAIN_SECONDS = NM_PREFIX
789      + "log.retain-seconds";
790  public static final long DEFAULT_NM_LOG_RETAIN_SECONDS = 3 * 60 * 60;
791
792  /**
793   * Define how often NMs wake up and upload log files
794   */
795  public static final String NM_LOG_AGGREGATION_ROLL_MONITORING_INTERVAL_SECONDS =
796      NM_PREFIX + "log-aggregation.roll-monitoring-interval-seconds";
797  public static final long
798      DEFAULT_NM_LOG_AGGREGATION_ROLL_MONITORING_INTERVAL_SECONDS = -1;
799  /**
800   * Number of threads used in log cleanup. Only applicable if Log aggregation
801   * is disabled
802   */
803  public static final String NM_LOG_DELETION_THREADS_COUNT = 
804    NM_PREFIX +  "log.deletion-threads-count";
805  public static final int DEFAULT_NM_LOG_DELETE_THREAD_COUNT = 4;
806
807  /** Where to aggregate logs to.*/
808  public static final String NM_REMOTE_APP_LOG_DIR = 
809    NM_PREFIX + "remote-app-log-dir";
810  public static final String DEFAULT_NM_REMOTE_APP_LOG_DIR = "/tmp/logs";
811
812  /**
813   * The remote log dir will be created at
814   * NM_REMOTE_APP_LOG_DIR/${user}/NM_REMOTE_APP_LOG_DIR_SUFFIX/${appId}
815   */
816  public static final String NM_REMOTE_APP_LOG_DIR_SUFFIX = 
817    NM_PREFIX + "remote-app-log-dir-suffix";
818  public static final String DEFAULT_NM_REMOTE_APP_LOG_DIR_SUFFIX="logs";
819
820  public static final String YARN_LOG_SERVER_URL =
821    YARN_PREFIX + "log.server.url";
822  
823  public static final String YARN_TRACKING_URL_GENERATOR = 
824      YARN_PREFIX + "tracking.url.generator";
825
826  /** Amount of memory in GB that can be allocated for containers.*/
827  public static final String NM_PMEM_MB = NM_PREFIX + "resource.memory-mb";
828  public static final int DEFAULT_NM_PMEM_MB = 8 * 1024;
829
830  /** Specifies whether physical memory check is enabled. */
831  public static final String NM_PMEM_CHECK_ENABLED = NM_PREFIX
832      + "pmem-check-enabled";
833  public static final boolean DEFAULT_NM_PMEM_CHECK_ENABLED = true;
834
835  /** Specifies whether physical memory check is enabled. */
836  public static final String NM_VMEM_CHECK_ENABLED = NM_PREFIX
837      + "vmem-check-enabled";
838  public static final boolean DEFAULT_NM_VMEM_CHECK_ENABLED = true;
839
840  /** Conversion ratio for physical memory to virtual memory. */
841  public static final String NM_VMEM_PMEM_RATIO =
842    NM_PREFIX + "vmem-pmem-ratio";
843  public static final float DEFAULT_NM_VMEM_PMEM_RATIO = 2.1f;
844  
845  /** Number of Virtual CPU Cores which can be allocated for containers.*/
846  public static final String NM_VCORES = NM_PREFIX + "resource.cpu-vcores";
847  public static final int DEFAULT_NM_VCORES = 8;
848
849  /** Percentage of overall CPU which can be allocated for containers. */
850  public static final String NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT =
851      NM_PREFIX + "resource.percentage-physical-cpu-limit";
852  public static final int DEFAULT_NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT =
853      100;
854  
855  /** NM Webapp address.**/
856  public static final String NM_WEBAPP_ADDRESS = NM_PREFIX + "webapp.address";
857  public static final int DEFAULT_NM_WEBAPP_PORT = 8042;
858  public static final String DEFAULT_NM_WEBAPP_ADDRESS = "0.0.0.0:" +
859    DEFAULT_NM_WEBAPP_PORT;
860  
861  /** NM Webapp https address.**/
862  public static final String NM_WEBAPP_HTTPS_ADDRESS = NM_PREFIX
863      + "webapp.https.address";
864  public static final int DEFAULT_NM_WEBAPP_HTTPS_PORT = 8044;
865  public static final String DEFAULT_NM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
866      + DEFAULT_NM_WEBAPP_HTTPS_PORT; 
867
868  /** Enable/disable CORS filter. */
869  public static final String NM_WEBAPP_ENABLE_CORS_FILTER =
870      NM_PREFIX + "webapp.cross-origin.enabled";
871  public static final boolean DEFAULT_NM_WEBAPP_ENABLE_CORS_FILTER = false;
872
873  /** How often to monitor containers.*/
874  public final static String NM_CONTAINER_MON_INTERVAL_MS =
875    NM_PREFIX + "container-monitor.interval-ms";
876  public final static int DEFAULT_NM_CONTAINER_MON_INTERVAL_MS = 3000;
877
878  /** Class that calculates containers current resource utilization.*/
879  public static final String NM_CONTAINER_MON_RESOURCE_CALCULATOR =
880    NM_PREFIX + "container-monitor.resource-calculator.class";
881  /** Class that calculates process tree resource utilization.*/
882  public static final String NM_CONTAINER_MON_PROCESS_TREE =
883    NM_PREFIX + "container-monitor.process-tree.class";
884  public static final String PROCFS_USE_SMAPS_BASED_RSS_ENABLED = NM_PREFIX +
885      "container-monitor.procfs-tree.smaps-based-rss.enabled";
886  public static final boolean DEFAULT_PROCFS_USE_SMAPS_BASED_RSS_ENABLED =
887      false;
888
889  /** Enable/disable container metrics. */
890  @Private
891  public static final String NM_CONTAINER_METRICS_ENABLE =
892      NM_PREFIX + "container-metrics.enable";
893  @Private
894  public static final boolean DEFAULT_NM_CONTAINER_METRICS_ENABLE = true;
895
896  /** Container metrics flush period. -1 for flush on completion. */
897  @Private
898  public static final String NM_CONTAINER_METRICS_PERIOD_MS =
899      NM_PREFIX + "container-metrics.period-ms";
900  @Private
901  public static final int DEFAULT_NM_CONTAINER_METRICS_PERIOD_MS = -1;
902
903  /** The delay time ms to unregister container metrics after completion. */
904  @Private
905  public static final String NM_CONTAINER_METRICS_UNREGISTER_DELAY_MS =
906      NM_PREFIX + "container-metrics.unregister-delay-ms";
907  @Private
908  public static final int DEFAULT_NM_CONTAINER_METRICS_UNREGISTER_DELAY_MS =
909      10000;
910
911  /** Prefix for all node manager disk health checker configs. */
912  private static final String NM_DISK_HEALTH_CHECK_PREFIX =
913      "yarn.nodemanager.disk-health-checker.";
914  /**
915   * Enable/Disable disks' health checker. Default is true. An expert level
916   * configuration property.
917   */
918  public static final String NM_DISK_HEALTH_CHECK_ENABLE =
919      NM_DISK_HEALTH_CHECK_PREFIX + "enable";
920  /** Frequency of running disks' health checker. */
921  public static final String NM_DISK_HEALTH_CHECK_INTERVAL_MS =
922      NM_DISK_HEALTH_CHECK_PREFIX + "interval-ms";
923  /** By default, disks' health is checked every 2 minutes. */
924  public static final long DEFAULT_NM_DISK_HEALTH_CHECK_INTERVAL_MS =
925      2 * 60 * 1000;
926
927  /**
928   * The minimum fraction of number of disks to be healthy for the nodemanager
929   * to launch new containers. This applies to nm-local-dirs and nm-log-dirs.
930   */
931  public static final String NM_MIN_HEALTHY_DISKS_FRACTION =
932      NM_DISK_HEALTH_CHECK_PREFIX + "min-healthy-disks";
933  /**
934   * By default, at least 25% of disks are to be healthy to say that the node is
935   * healthy in terms of disks.
936   */
937  public static final float DEFAULT_NM_MIN_HEALTHY_DISKS_FRACTION = 0.25F;
938
939  /**
940   * The maximum percentage of disk space that can be used after which a disk is
941   * marked as offline. Values can range from 0.0 to 100.0. If the value is
942   * greater than or equal to 100, NM will check for full disk. This applies to
943   * nm-local-dirs and nm-log-dirs.
944   */
945  public static final String NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE =
946      NM_DISK_HEALTH_CHECK_PREFIX + "max-disk-utilization-per-disk-percentage";
947  /**
948   * By default, 90% of the disk can be used before it is marked as offline.
949   */
950  public static final float DEFAULT_NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE =
951      90.0F;
952
953  /**
954   * The minimum space that must be available on a local dir for it to be used.
955   * This applies to nm-local-dirs and nm-log-dirs.
956   */
957  public static final String NM_MIN_PER_DISK_FREE_SPACE_MB =
958      NM_DISK_HEALTH_CHECK_PREFIX + "min-free-space-per-disk-mb";
959  /**
960   * By default, all of the disk can be used before it is marked as offline.
961   */
962  public static final long DEFAULT_NM_MIN_PER_DISK_FREE_SPACE_MB = 0;
963
964  /** Frequency of running node health script.*/
965  public static final String NM_HEALTH_CHECK_INTERVAL_MS = 
966    NM_PREFIX + "health-checker.interval-ms";
967  public static final long DEFAULT_NM_HEALTH_CHECK_INTERVAL_MS = 10 * 60 * 1000;
968
969  /** Health check script time out period.*/  
970  public static final String NM_HEALTH_CHECK_SCRIPT_TIMEOUT_MS = 
971    NM_PREFIX + "health-checker.script.timeout-ms";
972  public static final long DEFAULT_NM_HEALTH_CHECK_SCRIPT_TIMEOUT_MS = 
973    2 * DEFAULT_NM_HEALTH_CHECK_INTERVAL_MS;
974  
975  /** The health check script to run.*/
976  public static final String NM_HEALTH_CHECK_SCRIPT_PATH = 
977    NM_PREFIX + "health-checker.script.path";
978  
979  /** The arguments to pass to the health check script.*/
980  public static final String NM_HEALTH_CHECK_SCRIPT_OPTS = 
981    NM_PREFIX + "health-checker.script.opts";
982
983  /** The Docker image name(For DockerContainerExecutor).*/
984  public static final String NM_DOCKER_CONTAINER_EXECUTOR_IMAGE_NAME =
985    NM_PREFIX + "docker-container-executor.image-name";
986
987  /** The name of the docker executor (For DockerContainerExecutor).*/
988  public static final String NM_DOCKER_CONTAINER_EXECUTOR_EXEC_NAME =
989    NM_PREFIX + "docker-container-executor.exec-name";
990
991  /** The default docker executor (For DockerContainerExecutor).*/
992  public static final String NM_DEFAULT_DOCKER_CONTAINER_EXECUTOR_EXEC_NAME =
993          "/usr/bin/docker";
994
995  /** The path to the Linux container executor.*/
996  public static final String NM_LINUX_CONTAINER_EXECUTOR_PATH =
997    NM_PREFIX + "linux-container-executor.path";
998  
999  /** 
1000   * The UNIX group that the linux-container-executor should run as.
1001   * This is intended to be set as part of container-executor.cfg. 
1002   */
1003  public static final String NM_LINUX_CONTAINER_GROUP =
1004    NM_PREFIX + "linux-container-executor.group";
1005
1006  /**
1007   * If linux-container-executor should limit itself to one user
1008   * when running in non-secure mode.
1009   */
1010  public static final String NM_NONSECURE_MODE_LIMIT_USERS= NM_PREFIX +
1011     "linux-container-executor.nonsecure-mode.limit-users";
1012
1013  public static final boolean DEFAULT_NM_NONSECURE_MODE_LIMIT_USERS = true; 
1014
1015  /**
1016   * The UNIX user that containers will run as when Linux-container-executor
1017   * is used in nonsecure mode (a use case for this is using cgroups).
1018   */
1019  public static final String NM_NONSECURE_MODE_LOCAL_USER_KEY = NM_PREFIX +
1020      "linux-container-executor.nonsecure-mode.local-user";
1021
1022  public static final String DEFAULT_NM_NONSECURE_MODE_LOCAL_USER = "nobody";
1023
1024  /**
1025   * The allowed pattern for UNIX user names enforced by 
1026   * Linux-container-executor when used in nonsecure mode (use case for this 
1027   * is using cgroups). The default value is taken from /usr/sbin/adduser
1028   */
1029  public static final String NM_NONSECURE_MODE_USER_PATTERN_KEY = NM_PREFIX +
1030      "linux-container-executor.nonsecure-mode.user-pattern";
1031
1032  public static final String DEFAULT_NM_NONSECURE_MODE_USER_PATTERN = 
1033      "^[_.A-Za-z0-9][-@_.A-Za-z0-9]{0,255}?[$]?$";
1034
1035  /** The type of resource enforcement to use with the
1036   *  linux container executor.
1037   */
1038  public static final String NM_LINUX_CONTAINER_RESOURCES_HANDLER = 
1039  NM_PREFIX + "linux-container-executor.resources-handler.class";
1040  
1041  /** The path the linux container executor should use for cgroups */
1042  public static final String NM_LINUX_CONTAINER_CGROUPS_HIERARCHY =
1043    NM_PREFIX + "linux-container-executor.cgroups.hierarchy";
1044  
1045  /** Whether the linux container executor should mount cgroups if not found */
1046  public static final String NM_LINUX_CONTAINER_CGROUPS_MOUNT =
1047    NM_PREFIX + "linux-container-executor.cgroups.mount";
1048  
1049  /** Where the linux container executor should mount cgroups if not found */
1050  public static final String NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH =
1051    NM_PREFIX + "linux-container-executor.cgroups.mount-path";
1052
1053  /**
1054   * Whether the apps should run in strict resource usage mode(not allowed to
1055   * use spare CPU)
1056   */
1057  public static final String NM_LINUX_CONTAINER_CGROUPS_STRICT_RESOURCE_USAGE =
1058      NM_PREFIX + "linux-container-executor.cgroups.strict-resource-usage";
1059  public static final boolean DEFAULT_NM_LINUX_CONTAINER_CGROUPS_STRICT_RESOURCE_USAGE =
1060      false;
1061
1062
1063
1064  /**
1065   * Interval of time the linux container executor should try cleaning up
1066   * cgroups entry when cleaning up a container. This is required due to what 
1067   * it seems a race condition because the SIGTERM/SIGKILL is asynch.
1068   */
1069  public static final String NM_LINUX_CONTAINER_CGROUPS_DELETE_TIMEOUT =
1070   NM_PREFIX + "linux-container-executor.cgroups.delete-timeout-ms";
1071
1072  public static final long DEFAULT_NM_LINUX_CONTAINER_CGROUPS_DELETE_TIMEOUT =
1073      1000;
1074
1075  /**
1076   * Delay between attempts to remove linux cgroup.
1077   */
1078  public static final String NM_LINUX_CONTAINER_CGROUPS_DELETE_DELAY =
1079      NM_PREFIX + "linux-container-executor.cgroups.delete-delay-ms";
1080
1081  public static final long DEFAULT_NM_LINUX_CONTAINER_CGROUPS_DELETE_DELAY =
1082      20;
1083
1084  /**
1085   * Indicates if memory and CPU limits will be set for the Windows Job
1086   * Object for the containers launched by the default container executor.
1087   */
1088  public static final String NM_WINDOWS_CONTAINER_MEMORY_LIMIT_ENABLED =
1089      NM_PREFIX + "windows-container.memory-limit.enabled";
1090  public static final boolean DEFAULT_NM_WINDOWS_CONTAINER_MEMORY_LIMIT_ENABLED = false;
1091
1092  public static final String NM_WINDOWS_CONTAINER_CPU_LIMIT_ENABLED =
1093      NM_PREFIX + "windows-container.cpu-limit.enabled";
1094  public static final boolean DEFAULT_NM_WINDOWS_CONTAINER_CPU_LIMIT_ENABLED = false;
1095
1096  /** 
1097  /* The Windows group that the windows-secure-container-executor should run as.
1098  */
1099  public static final String NM_WINDOWS_SECURE_CONTAINER_GROUP =
1100      NM_PREFIX + "windows-secure-container-executor.group";
1101
1102  /** T-file compression types used to compress aggregated logs.*/
1103  public static final String NM_LOG_AGG_COMPRESSION_TYPE = 
1104    NM_PREFIX + "log-aggregation.compression-type";
1105  public static final String DEFAULT_NM_LOG_AGG_COMPRESSION_TYPE = "none";
1106  
1107  /** The kerberos principal for the node manager.*/
1108  public static final String NM_PRINCIPAL =
1109    NM_PREFIX + "principal";
1110  
1111  public static final String NM_AUX_SERVICES = 
1112    NM_PREFIX + "aux-services";
1113  
1114  public static final String NM_AUX_SERVICE_FMT =
1115    NM_PREFIX + "aux-services.%s.class";
1116
1117  public static final String NM_USER_HOME_DIR =
1118      NM_PREFIX + "user-home-dir";
1119  
1120  /**The kerberos principal to be used for spnego filter for NM.*/
1121  public static final String NM_WEBAPP_SPNEGO_USER_NAME_KEY =
1122      NM_PREFIX + "webapp.spnego-principal";
1123  
1124  /**The kerberos keytab to be used for spnego filter for NM.*/
1125  public static final String NM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY =
1126      NM_PREFIX + "webapp.spnego-keytab-file";
1127  
1128  public static final String DEFAULT_NM_USER_HOME_DIR= "/home/";
1129
1130  public static final String NM_RECOVERY_PREFIX = NM_PREFIX + "recovery.";
1131  public static final String NM_RECOVERY_ENABLED =
1132      NM_RECOVERY_PREFIX + "enabled";
1133  public static final boolean DEFAULT_NM_RECOVERY_ENABLED = false;
1134
1135  public static final String NM_RECOVERY_DIR = NM_RECOVERY_PREFIX + "dir";
1136
1137  /** The time in seconds between full compactions of the NM state database.
1138   *  Setting the interval to zero disables the full compaction cycles.
1139   */
1140  public static final String NM_RECOVERY_COMPACTION_INTERVAL_SECS =
1141      NM_RECOVERY_PREFIX + "compaction-interval-secs";
1142  public static final int DEFAULT_NM_RECOVERY_COMPACTION_INTERVAL_SECS = 3600;
1143
1144  ////////////////////////////////
1145  // Web Proxy Configs
1146  ////////////////////////////////
1147  public static final String PROXY_PREFIX = "yarn.web-proxy.";
1148  
1149  /** The kerberos principal for the proxy.*/
1150  public static final String PROXY_PRINCIPAL =
1151    PROXY_PREFIX + "principal";
1152  
1153  /** Keytab for Proxy.*/
1154  public static final String PROXY_KEYTAB = PROXY_PREFIX + "keytab";
1155  
1156  /** The address for the web proxy.*/
1157  public static final String PROXY_ADDRESS =
1158    PROXY_PREFIX + "address";
1159  public static final int DEFAULT_PROXY_PORT = 9099;
1160  public static final String DEFAULT_PROXY_ADDRESS =
1161    "0.0.0.0:" + DEFAULT_PROXY_PORT;
1162  
1163  /**
1164   * YARN Service Level Authorization
1165   */
1166  public static final String 
1167  YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCETRACKER_PROTOCOL =
1168      "security.resourcetracker.protocol.acl";
1169  public static final String 
1170  YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONCLIENT_PROTOCOL =
1171      "security.applicationclient.protocol.acl";
1172  public static final String 
1173  YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCEMANAGER_ADMINISTRATION_PROTOCOL =
1174      "security.resourcemanager-administration.protocol.acl";
1175  public static final String 
1176  YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONMASTER_PROTOCOL =
1177      "security.applicationmaster.protocol.acl";
1178
1179  public static final String 
1180  YARN_SECURITY_SERVICE_AUTHORIZATION_CONTAINER_MANAGEMENT_PROTOCOL =
1181      "security.containermanagement.protocol.acl";
1182  public static final String 
1183  YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCE_LOCALIZER =
1184      "security.resourcelocalizer.protocol.acl";
1185
1186  public static final String
1187  YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONHISTORY_PROTOCOL =
1188      "security.applicationhistory.protocol.acl";
1189
1190  /** No. of milliseconds to wait between sending a SIGTERM and SIGKILL
1191   * to a running container */
1192  public static final String NM_SLEEP_DELAY_BEFORE_SIGKILL_MS =
1193      NM_PREFIX + "sleep-delay-before-sigkill.ms";
1194  public static final long DEFAULT_NM_SLEEP_DELAY_BEFORE_SIGKILL_MS =
1195      250;
1196
1197  /** Max time to wait for a process to come up when trying to cleanup
1198   * container resources */
1199  public static final String NM_PROCESS_KILL_WAIT_MS =
1200      NM_PREFIX + "process-kill-wait.ms";
1201  public static final long DEFAULT_NM_PROCESS_KILL_WAIT_MS =
1202      2000;
1203
1204  /** Max time to wait to establish a connection to RM */
1205  public static final String RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
1206      RM_PREFIX + "connect.max-wait.ms";
1207  public static final long DEFAULT_RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
1208      15 * 60 * 1000;
1209
1210  /** Time interval between each attempt to connect to RM */
1211  public static final String RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS =
1212      RM_PREFIX + "connect.retry-interval.ms";
1213  public static final long DEFAULT_RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS
1214      = 30 * 1000;
1215
1216  public static final String DISPATCHER_DRAIN_EVENTS_TIMEOUT =
1217      YARN_PREFIX + "dispatcher.drain-events.timeout";
1218
1219  public static final long DEFAULT_DISPATCHER_DRAIN_EVENTS_TIMEOUT = 300000;
1220
1221  /**
1222   * CLASSPATH for YARN applications. A comma-separated list of CLASSPATH
1223   * entries
1224   */
1225  public static final String YARN_APPLICATION_CLASSPATH = YARN_PREFIX
1226      + "application.classpath";
1227
1228  /**
1229   * Default platform-agnostic CLASSPATH for YARN applications. A
1230   * comma-separated list of CLASSPATH entries. The parameter expansion marker
1231   * will be replaced with real parameter expansion marker ('%' for Windows and
1232   * '$' for Linux) by NodeManager on container launch. For example: {{VAR}}
1233   * will be replaced as $VAR on Linux, and %VAR% on Windows.
1234   */
1235  @Public
1236  @Unstable
1237  public static final String[] DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH= {
1238      ApplicationConstants.Environment.HADOOP_CONF_DIR.$$(),
1239      ApplicationConstants.Environment.HADOOP_COMMON_HOME.$$()
1240          + "/share/hadoop/common/*",
1241      ApplicationConstants.Environment.HADOOP_COMMON_HOME.$$()
1242          + "/share/hadoop/common/lib/*",
1243      ApplicationConstants.Environment.HADOOP_HDFS_HOME.$$()
1244          + "/share/hadoop/hdfs/*",
1245      ApplicationConstants.Environment.HADOOP_HDFS_HOME.$$()
1246          + "/share/hadoop/hdfs/lib/*",
1247      ApplicationConstants.Environment.HADOOP_YARN_HOME.$$()
1248          + "/share/hadoop/yarn/*",
1249      ApplicationConstants.Environment.HADOOP_YARN_HOME.$$()
1250          + "/share/hadoop/yarn/lib/*" };
1251  /**
1252   * <p>
1253   * Default platform-specific CLASSPATH for YARN applications. A
1254   * comma-separated list of CLASSPATH entries constructed based on the client
1255   * OS environment expansion syntax.
1256   * </p>
1257   * <p>
1258   * Note: Use {@link #DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH} for
1259   * cross-platform practice i.e. submit an application from a Windows client to
1260   * a Linux/Unix server or vice versa.
1261   * </p>
1262   */
1263  public static final String[] DEFAULT_YARN_APPLICATION_CLASSPATH = {
1264      ApplicationConstants.Environment.HADOOP_CONF_DIR.$(),
1265      ApplicationConstants.Environment.HADOOP_COMMON_HOME.$()
1266          + "/share/hadoop/common/*",
1267      ApplicationConstants.Environment.HADOOP_COMMON_HOME.$()
1268          + "/share/hadoop/common/lib/*",
1269      ApplicationConstants.Environment.HADOOP_HDFS_HOME.$()
1270          + "/share/hadoop/hdfs/*",
1271      ApplicationConstants.Environment.HADOOP_HDFS_HOME.$()
1272          + "/share/hadoop/hdfs/lib/*",
1273      ApplicationConstants.Environment.HADOOP_YARN_HOME.$()
1274          + "/share/hadoop/yarn/*",
1275      ApplicationConstants.Environment.HADOOP_YARN_HOME.$()
1276          + "/share/hadoop/yarn/lib/*" };
1277
1278  /** Container temp directory */
1279  public static final String DEFAULT_CONTAINER_TEMP_DIR = "./tmp";
1280
1281  public static final String IS_MINI_YARN_CLUSTER = YARN_PREFIX
1282      + "is.minicluster";
1283
1284  public static final String YARN_MC_PREFIX = YARN_PREFIX + "minicluster.";
1285
1286  /** Whether to use fixed ports with the minicluster. */
1287  public static final String YARN_MINICLUSTER_FIXED_PORTS =
1288      YARN_MC_PREFIX + "fixed.ports";
1289
1290  /**
1291   * Default is false to be able to run tests concurrently without port
1292   * conflicts.
1293   */
1294  public static final boolean DEFAULT_YARN_MINICLUSTER_FIXED_PORTS = false;
1295
1296  /**
1297   * Whether the NM should use RPC to connect to the RM. Default is false.
1298   * Can be set to true only when using fixed ports.
1299   */
1300  public static final String YARN_MINICLUSTER_USE_RPC = YARN_MC_PREFIX + "use-rpc";
1301  public static final boolean DEFAULT_YARN_MINICLUSTER_USE_RPC = false;
1302
1303  /**
1304   * Whether users are explicitly trying to control resource monitoring
1305   * configuration for the MiniYARNCluster. Disabled by default.
1306   */
1307  public static final String YARN_MINICLUSTER_CONTROL_RESOURCE_MONITORING =
1308      YARN_MC_PREFIX + "control-resource-monitoring";
1309  public static final boolean
1310      DEFAULT_YARN_MINICLUSTER_CONTROL_RESOURCE_MONITORING = false;
1311
1312  /** Allow changing the memory for the NodeManager in the MiniYARNCluster */
1313  public static final String YARN_MINICLUSTER_NM_PMEM_MB =
1314      YARN_MC_PREFIX + YarnConfiguration.NM_PMEM_MB;
1315  public static final int DEFAULT_YARN_MINICLUSTER_NM_PMEM_MB = 4 * 1024;
1316
1317  /** The log directory for the containers */
1318  public static final String YARN_APP_CONTAINER_LOG_DIR =
1319      YARN_PREFIX + "app.container.log.dir";
1320
1321  public static final String YARN_APP_CONTAINER_LOG_SIZE =
1322      YARN_PREFIX + "app.container.log.filesize";
1323
1324  public static final String YARN_APP_CONTAINER_LOG_BACKUPS =
1325      YARN_PREFIX + "app.container.log.backups";
1326
1327  ////////////////////////////////
1328  // Timeline Service Configs
1329  ////////////////////////////////
1330
1331  public static final String TIMELINE_SERVICE_PREFIX =
1332      YARN_PREFIX + "timeline-service.";
1333
1334  /**
1335   * Comma seperated list of names for UIs hosted in the timeline server
1336   * (For pluggable UIs).
1337   */
1338  public static final String TIMELINE_SERVICE_UI_NAMES =
1339      TIMELINE_SERVICE_PREFIX + "ui-names";
1340
1341  /** Relative web path that will serve up this UI (For pluggable UIs). */
1342  public static final String TIMELINE_SERVICE_UI_WEB_PATH_PREFIX =
1343      TIMELINE_SERVICE_PREFIX + "ui-web-path.";
1344
1345  /**
1346   * Path to war file or static content directory for this UI
1347   * (For pluggable UIs).
1348   */
1349  public static final String TIMELINE_SERVICE_UI_ON_DISK_PATH_PREFIX =
1350      TIMELINE_SERVICE_PREFIX + "ui-on-disk-path.";
1351
1352  // mark app-history related configs @Private as application history is going
1353  // to be integrated into the timeline service
1354  @Private
1355  public static final String APPLICATION_HISTORY_PREFIX =
1356      TIMELINE_SERVICE_PREFIX + "generic-application-history.";
1357
1358  /**
1359   *  The setting that controls whether application history service is
1360   *  enabled or not.
1361   */
1362  @Private
1363  public static final String APPLICATION_HISTORY_ENABLED =
1364      APPLICATION_HISTORY_PREFIX + "enabled";
1365  @Private
1366  public static final boolean DEFAULT_APPLICATION_HISTORY_ENABLED = false;
1367
1368  /** Application history store class */
1369  @Private
1370  public static final String APPLICATION_HISTORY_STORE =
1371      APPLICATION_HISTORY_PREFIX + "store-class";
1372
1373  /** Save container meta-info in the application history store. */
1374  @Private
1375  public static final String
1376      APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO =
1377        APPLICATION_HISTORY_PREFIX + "save-non-am-container-meta-info";
1378  @Private
1379  public static final boolean
1380            DEFAULT_APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO = true;
1381
1382  /** URI for FileSystemApplicationHistoryStore */
1383  @Private
1384  public static final String FS_APPLICATION_HISTORY_STORE_URI =
1385      APPLICATION_HISTORY_PREFIX + "fs-history-store.uri";
1386
1387  /** T-file compression types used to compress history data.*/
1388  @Private
1389  public static final String FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE =
1390      APPLICATION_HISTORY_PREFIX + "fs-history-store.compression-type";
1391  @Private
1392  public static final String DEFAULT_FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE =
1393      "none";
1394
1395  /** The setting that controls whether timeline service is enabled or not. */
1396  public static final String TIMELINE_SERVICE_ENABLED =
1397      TIMELINE_SERVICE_PREFIX + "enabled";
1398  public static final boolean DEFAULT_TIMELINE_SERVICE_ENABLED = false;
1399
1400  /** host:port address for timeline service RPC APIs. */
1401  public static final String TIMELINE_SERVICE_ADDRESS =
1402      TIMELINE_SERVICE_PREFIX + "address";
1403  public static final int DEFAULT_TIMELINE_SERVICE_PORT = 10200;
1404  public static final String DEFAULT_TIMELINE_SERVICE_ADDRESS = "0.0.0.0:"
1405      + DEFAULT_TIMELINE_SERVICE_PORT;
1406
1407  /** The listening endpoint for the timeline service application.*/
1408  public static final String TIMELINE_SERVICE_BIND_HOST =
1409      TIMELINE_SERVICE_PREFIX + "bind-host";
1410
1411  /** The number of threads to handle client RPC API requests. */
1412  public static final String TIMELINE_SERVICE_HANDLER_THREAD_COUNT =
1413      TIMELINE_SERVICE_PREFIX + "handler-thread-count";
1414  public static final int DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT = 10;
1415  
1416
1417  /** The address of the timeline service web application.*/
1418  public static final String TIMELINE_SERVICE_WEBAPP_ADDRESS =
1419      TIMELINE_SERVICE_PREFIX  + "webapp.address";
1420
1421  public static final int DEFAULT_TIMELINE_SERVICE_WEBAPP_PORT = 8188;
1422  public static final String DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS =
1423      "0.0.0.0:" + DEFAULT_TIMELINE_SERVICE_WEBAPP_PORT;
1424
1425  /** The https address of the timeline service web application.*/
1426  public static final String TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS =
1427      TIMELINE_SERVICE_PREFIX + "webapp.https.address";
1428
1429  public static final int DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_PORT = 8190;
1430  public static final String DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS =
1431      "0.0.0.0:" + DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_PORT;
1432
1433  /**
1434   * Defines the max number of applications could be fetched using
1435   * REST API or application history protocol and shown in timeline
1436   * server web ui.
1437   */
1438  public static final String APPLICATION_HISTORY_MAX_APPS =
1439      APPLICATION_HISTORY_PREFIX + "max-applications";
1440  public static final long DEFAULT_APPLICATION_HISTORY_MAX_APPS = 10000;
1441
1442  /** Timeline service store class */
1443  public static final String TIMELINE_SERVICE_STORE =
1444      TIMELINE_SERVICE_PREFIX + "store-class";
1445
1446  /** Timeline service enable data age off */
1447  public static final String TIMELINE_SERVICE_TTL_ENABLE =
1448      TIMELINE_SERVICE_PREFIX + "ttl-enable";
1449
1450  /** Timeline service length of time to retain data */
1451  public static final String TIMELINE_SERVICE_TTL_MS =
1452      TIMELINE_SERVICE_PREFIX + "ttl-ms";
1453
1454  public static final long DEFAULT_TIMELINE_SERVICE_TTL_MS =
1455      1000 * 60 * 60 * 24 * 7;
1456
1457  public static final String TIMELINE_SERVICE_LEVELDB_PREFIX =
1458      TIMELINE_SERVICE_PREFIX + "leveldb-timeline-store.";
1459
1460  /** Timeline service leveldb path */
1461  public static final String TIMELINE_SERVICE_LEVELDB_PATH =
1462      TIMELINE_SERVICE_LEVELDB_PREFIX + "path";
1463
1464  /** Timeline service leveldb read cache (uncompressed blocks) */
1465  public static final String TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE =
1466      TIMELINE_SERVICE_LEVELDB_PREFIX + "read-cache-size";
1467
1468  public static final long DEFAULT_TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE =
1469      100 * 1024 * 1024;
1470
1471  /** Timeline service leveldb start time read cache (number of entities) */
1472  public static final String
1473      TIMELINE_SERVICE_LEVELDB_START_TIME_READ_CACHE_SIZE =
1474      TIMELINE_SERVICE_LEVELDB_PREFIX + "start-time-read-cache-size";
1475
1476  public static final int
1477      DEFAULT_TIMELINE_SERVICE_LEVELDB_START_TIME_READ_CACHE_SIZE = 10000;
1478
1479  /** Timeline service leveldb start time write cache (number of entities) */
1480  public static final String
1481      TIMELINE_SERVICE_LEVELDB_START_TIME_WRITE_CACHE_SIZE =
1482      TIMELINE_SERVICE_LEVELDB_PREFIX + "start-time-write-cache-size";
1483
1484  public static final int
1485      DEFAULT_TIMELINE_SERVICE_LEVELDB_START_TIME_WRITE_CACHE_SIZE = 10000;
1486
1487  /** Timeline service leveldb interval to wait between deletion rounds */
1488  public static final String TIMELINE_SERVICE_LEVELDB_TTL_INTERVAL_MS =
1489      TIMELINE_SERVICE_LEVELDB_PREFIX + "ttl-interval-ms";
1490
1491  public static final long DEFAULT_TIMELINE_SERVICE_LEVELDB_TTL_INTERVAL_MS =
1492      1000 * 60 * 5;
1493
1494  /** The Kerberos principal for the timeline server.*/
1495  public static final String TIMELINE_SERVICE_PRINCIPAL =
1496      TIMELINE_SERVICE_PREFIX + "principal";
1497
1498  /** The Kerberos keytab for the timeline server.*/
1499  public static final String TIMELINE_SERVICE_KEYTAB =
1500      TIMELINE_SERVICE_PREFIX + "keytab";
1501
1502  /** Enables cross origin support for timeline server.*/
1503  public static final String TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED =
1504      TIMELINE_SERVICE_PREFIX + "http-cross-origin.enabled";
1505
1506  /** Default value for cross origin support for timeline server.*/
1507  public static final boolean
1508      TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED_DEFAULT = false;
1509
1510  /** Timeline client settings */
1511  public static final String TIMELINE_SERVICE_CLIENT_PREFIX =
1512      TIMELINE_SERVICE_PREFIX + "client.";
1513
1514  /** Timeline client call, max retries (-1 means no limit) */
1515  public static final String TIMELINE_SERVICE_CLIENT_MAX_RETRIES =
1516      TIMELINE_SERVICE_CLIENT_PREFIX + "max-retries";
1517
1518  public static final int DEFAULT_TIMELINE_SERVICE_CLIENT_MAX_RETRIES = 30;
1519
1520  /** Timeline client call, retry interval */
1521  public static final String TIMELINE_SERVICE_CLIENT_RETRY_INTERVAL_MS =
1522      TIMELINE_SERVICE_CLIENT_PREFIX + "retry-interval-ms";
1523
1524  public static final long
1525      DEFAULT_TIMELINE_SERVICE_CLIENT_RETRY_INTERVAL_MS = 1000;
1526
1527  /** Timeline client policy for whether connections are fatal */
1528  public static final String TIMELINE_SERVICE_CLIENT_BEST_EFFORT =
1529      TIMELINE_SERVICE_CLIENT_PREFIX + "best-effort";
1530
1531  public static final boolean
1532      DEFAULT_TIMELINE_SERVICE_CLIENT_BEST_EFFORT = false;
1533
1534  /** Flag to enable recovery of timeline service */
1535  public static final String TIMELINE_SERVICE_RECOVERY_ENABLED =
1536      TIMELINE_SERVICE_PREFIX + "recovery.enabled";
1537  public static final boolean DEFAULT_TIMELINE_SERVICE_RECOVERY_ENABLED = false;
1538
1539  /** Timeline service state store class */
1540  public static final String TIMELINE_SERVICE_STATE_STORE_CLASS =
1541      TIMELINE_SERVICE_PREFIX + "state-store-class";
1542
1543  public static final String TIMELINE_SERVICE_LEVELDB_STATE_STORE_PREFIX =
1544      TIMELINE_SERVICE_PREFIX + "leveldb-state-store.";
1545
1546  /** Timeline service state store leveldb path */
1547  public static final String TIMELINE_SERVICE_LEVELDB_STATE_STORE_PATH =
1548      TIMELINE_SERVICE_LEVELDB_STATE_STORE_PREFIX + "path";
1549
1550  // Timeline delegation token related keys
1551  public static final String  TIMELINE_DELEGATION_KEY_UPDATE_INTERVAL =
1552      TIMELINE_SERVICE_PREFIX + "delegation.key.update-interval";
1553  public static final long    DEFAULT_TIMELINE_DELEGATION_KEY_UPDATE_INTERVAL =
1554      24*60*60*1000; // 1 day
1555  public static final String  TIMELINE_DELEGATION_TOKEN_RENEW_INTERVAL =
1556      TIMELINE_SERVICE_PREFIX + "delegation.token.renew-interval";
1557  public static final long    DEFAULT_TIMELINE_DELEGATION_TOKEN_RENEW_INTERVAL =
1558      24*60*60*1000;  // 1 day
1559  public static final String  TIMELINE_DELEGATION_TOKEN_MAX_LIFETIME =
1560      TIMELINE_SERVICE_PREFIX + "delegation.token.max-lifetime";
1561  public static final long    DEFAULT_TIMELINE_DELEGATION_TOKEN_MAX_LIFETIME =
1562      7*24*60*60*1000; // 7 days
1563
1564  // ///////////////////////////////
1565  // Shared Cache Configs
1566  // ///////////////////////////////
1567  public static final String SHARED_CACHE_PREFIX = "yarn.sharedcache.";
1568
1569  // common configs
1570  /** whether the shared cache is enabled/disabled */
1571  public static final String SHARED_CACHE_ENABLED =
1572      SHARED_CACHE_PREFIX + "enabled";
1573  public static final boolean DEFAULT_SHARED_CACHE_ENABLED = false;
1574
1575  /** The config key for the shared cache root directory. */
1576  public static final String SHARED_CACHE_ROOT =
1577      SHARED_CACHE_PREFIX + "root-dir";
1578  public static final String DEFAULT_SHARED_CACHE_ROOT = "/sharedcache";
1579
1580  /** The config key for the level of nested directories before getting to the
1581   * checksum directory. */
1582  public static final String SHARED_CACHE_NESTED_LEVEL =
1583      SHARED_CACHE_PREFIX + "nested-level";
1584  public static final int DEFAULT_SHARED_CACHE_NESTED_LEVEL = 3;
1585  
1586  // Shared Cache Manager Configs
1587
1588  public static final String SCM_STORE_PREFIX = SHARED_CACHE_PREFIX + "store.";
1589
1590  public static final String SCM_STORE_CLASS = SCM_STORE_PREFIX + "class";
1591  public static final String DEFAULT_SCM_STORE_CLASS =
1592      "org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore";
1593
1594  public static final String SCM_APP_CHECKER_CLASS = SHARED_CACHE_PREFIX
1595      + "app-checker.class";
1596  public static final String DEFAULT_SCM_APP_CHECKER_CLASS =
1597      "org.apache.hadoop.yarn.server.sharedcachemanager.RemoteAppChecker";
1598
1599  /** The address of the SCM admin interface. */
1600  public static final String SCM_ADMIN_ADDRESS =
1601      SHARED_CACHE_PREFIX + "admin.address";
1602  public static final int DEFAULT_SCM_ADMIN_PORT = 8047;
1603  public static final String DEFAULT_SCM_ADMIN_ADDRESS =
1604      "0.0.0.0:" + DEFAULT_SCM_ADMIN_PORT;
1605
1606  /** Number of threads used to handle SCM admin interface. */
1607  public static final String SCM_ADMIN_CLIENT_THREAD_COUNT =
1608      SHARED_CACHE_PREFIX + "admin.thread-count";
1609  public static final int DEFAULT_SCM_ADMIN_CLIENT_THREAD_COUNT = 1;
1610
1611  /** The address of the SCM web application. */
1612  public static final String SCM_WEBAPP_ADDRESS =
1613      SHARED_CACHE_PREFIX + "webapp.address";
1614  public static final int DEFAULT_SCM_WEBAPP_PORT = 8788;
1615  public static final String DEFAULT_SCM_WEBAPP_ADDRESS =
1616      "0.0.0.0:" + DEFAULT_SCM_WEBAPP_PORT;
1617
1618  // In-memory SCM store configuration
1619  
1620  public static final String IN_MEMORY_STORE_PREFIX =
1621      SCM_STORE_PREFIX + "in-memory.";
1622
1623  /**
1624   * A resource in the InMemorySCMStore is considered stale if the time since
1625   * the last reference exceeds the staleness period. This value is specified in
1626   * minutes.
1627   */
1628  public static final String IN_MEMORY_STALENESS_PERIOD_MINS =
1629      IN_MEMORY_STORE_PREFIX + "staleness-period-mins";
1630  public static final int DEFAULT_IN_MEMORY_STALENESS_PERIOD_MINS =
1631      7 * 24 * 60;
1632
1633  /**
1634   * Initial delay before the in-memory store runs its first check to remove
1635   * dead initial applications. Specified in minutes.
1636   */
1637  public static final String IN_MEMORY_INITIAL_DELAY_MINS =
1638      IN_MEMORY_STORE_PREFIX + "initial-delay-mins";
1639  public static final int DEFAULT_IN_MEMORY_INITIAL_DELAY_MINS = 10;
1640  
1641  /**
1642   * The frequency at which the in-memory store checks to remove dead initial
1643   * applications. Specified in minutes.
1644   */
1645  public static final String IN_MEMORY_CHECK_PERIOD_MINS =
1646      IN_MEMORY_STORE_PREFIX + "check-period-mins";
1647  public static final int DEFAULT_IN_MEMORY_CHECK_PERIOD_MINS = 12 * 60;
1648
1649  // SCM Cleaner service configuration
1650
1651  private static final String SCM_CLEANER_PREFIX = SHARED_CACHE_PREFIX
1652      + "cleaner.";
1653
1654  /**
1655   * The frequency at which a cleaner task runs. Specified in minutes.
1656   */
1657  public static final String SCM_CLEANER_PERIOD_MINS =
1658      SCM_CLEANER_PREFIX + "period-mins";
1659  public static final int DEFAULT_SCM_CLEANER_PERIOD_MINS = 24 * 60;
1660
1661  /**
1662   * Initial delay before the first cleaner task is scheduled. Specified in
1663   * minutes.
1664   */
1665  public static final String SCM_CLEANER_INITIAL_DELAY_MINS =
1666      SCM_CLEANER_PREFIX + "initial-delay-mins";
1667  public static final int DEFAULT_SCM_CLEANER_INITIAL_DELAY_MINS = 10;
1668
1669  /**
1670   * The time to sleep between processing each shared cache resource. Specified
1671   * in milliseconds.
1672   */
1673  public static final String SCM_CLEANER_RESOURCE_SLEEP_MS =
1674      SCM_CLEANER_PREFIX + "resource-sleep-ms";
1675  public static final long DEFAULT_SCM_CLEANER_RESOURCE_SLEEP_MS = 0L;
1676
1677  /** The address of the node manager interface in the SCM. */
1678  public static final String SCM_UPLOADER_SERVER_ADDRESS = SHARED_CACHE_PREFIX
1679      + "uploader.server.address";
1680  public static final int DEFAULT_SCM_UPLOADER_SERVER_PORT = 8046;
1681  public static final String DEFAULT_SCM_UPLOADER_SERVER_ADDRESS = "0.0.0.0:"
1682      + DEFAULT_SCM_UPLOADER_SERVER_PORT;
1683
1684  /**
1685   * The number of SCM threads used to handle notify requests from the node
1686   * manager.
1687   */
1688  public static final String SCM_UPLOADER_SERVER_THREAD_COUNT =
1689      SHARED_CACHE_PREFIX + "uploader.server.thread-count";
1690  public static final int DEFAULT_SCM_UPLOADER_SERVER_THREAD_COUNT = 50;
1691
1692  /** The address of the client interface in the SCM. */
1693  public static final String SCM_CLIENT_SERVER_ADDRESS =
1694      SHARED_CACHE_PREFIX + "client-server.address";
1695  public static final int DEFAULT_SCM_CLIENT_SERVER_PORT = 8045;
1696  public static final String DEFAULT_SCM_CLIENT_SERVER_ADDRESS = "0.0.0.0:"
1697      + DEFAULT_SCM_CLIENT_SERVER_PORT;
1698
1699  /** The number of threads used to handle shared cache manager requests. */
1700  public static final String SCM_CLIENT_SERVER_THREAD_COUNT =
1701      SHARED_CACHE_PREFIX + "client-server.thread-count";
1702  public static final int DEFAULT_SCM_CLIENT_SERVER_THREAD_COUNT = 50;
1703
1704  /** the checksum algorithm implementation **/
1705  public static final String SHARED_CACHE_CHECKSUM_ALGO_IMPL =
1706      SHARED_CACHE_PREFIX + "checksum.algo.impl";
1707  public static final String DEFAULT_SHARED_CACHE_CHECKSUM_ALGO_IMPL =
1708      "org.apache.hadoop.yarn.sharedcache.ChecksumSHA256Impl";
1709
1710  // node manager (uploader) configs
1711  /**
1712   * The replication factor for the node manager uploader for the shared cache.
1713   */
1714  public static final String SHARED_CACHE_NM_UPLOADER_REPLICATION_FACTOR =
1715      SHARED_CACHE_PREFIX + "nm.uploader.replication.factor";
1716  public static final int DEFAULT_SHARED_CACHE_NM_UPLOADER_REPLICATION_FACTOR =
1717      10;
1718
1719  public static final String SHARED_CACHE_NM_UPLOADER_THREAD_COUNT =
1720      SHARED_CACHE_PREFIX + "nm.uploader.thread-count";
1721  public static final int DEFAULT_SHARED_CACHE_NM_UPLOADER_THREAD_COUNT = 20;
1722
1723  ////////////////////////////////
1724  // Other Configs
1725  ////////////////////////////////
1726
1727  /**
1728   * Use YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS instead.
1729   * The interval of the yarn client's querying application state after
1730   * application submission. The unit is millisecond.
1731   */
1732  @Deprecated
1733  public static final String YARN_CLIENT_APP_SUBMISSION_POLL_INTERVAL_MS =
1734      YARN_PREFIX + "client.app-submission.poll-interval";
1735
1736  /**
1737   * The interval that the yarn client library uses to poll the completion
1738   * status of the asynchronous API of application client protocol.
1739   */
1740  public static final String YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS =
1741      YARN_PREFIX + "client.application-client-protocol.poll-interval-ms";
1742  public static final long DEFAULT_YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS =
1743      200;
1744
1745  /**
1746   * The duration that the yarn client library waits, cumulatively across polls,
1747   * for an expected state change to occur. Defaults to -1, which indicates no
1748   * limit.
1749   */
1750  public static final String YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_TIMEOUT_MS =
1751      YARN_PREFIX + "client.application-client-protocol.poll-timeout-ms";
1752  public static final long DEFAULT_YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_TIMEOUT_MS =
1753      -1;
1754
1755  /**
1756   * Max number of threads in NMClientAsync to process container management
1757   * events
1758   */
1759  public static final String NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE =
1760      YARN_PREFIX + "client.nodemanager-client-async.thread-pool-max-size";
1761  public static final int DEFAULT_NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE = 500;
1762
1763  /**
1764   * Maximum number of proxy connections to cache for node managers. If set
1765   * to a value greater than zero then the cache is enabled and the NMClient
1766   * and MRAppMaster will cache the specified number of node manager proxies.
1767   * There will be at max one proxy per node manager. Ex. configuring it to a
1768   * value of 5 will make sure that client will at max have 5 proxies cached
1769   * with 5 different node managers. These connections for these proxies will
1770   * be timed out if idle for more than the system wide idle timeout period.
1771   * Note that this could cause issues on large clusters as many connections
1772   * could linger simultaneously and lead to a large number of connection
1773   * threads. The token used for authentication will be used only at
1774   * connection creation time. If a new token is received then the earlier
1775   * connection should be closed in order to use the new token. This and
1776   * {@link YarnConfiguration#NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE} are related
1777   * and should be in sync (no need for them to be equal).
1778   * If the value of this property is zero then the connection cache is
1779   * disabled and connections will use a zero idle timeout to prevent too
1780   * many connection threads on large clusters.
1781   */
1782  public static final String NM_CLIENT_MAX_NM_PROXIES =
1783      YARN_PREFIX + "client.max-cached-nodemanagers-proxies";
1784  public static final int DEFAULT_NM_CLIENT_MAX_NM_PROXIES = 0;
1785
1786  /** Max time to wait to establish a connection to NM */
1787  public static final String CLIENT_NM_CONNECT_MAX_WAIT_MS =
1788      YARN_PREFIX + "client.nodemanager-connect.max-wait-ms";
1789  public static final long DEFAULT_CLIENT_NM_CONNECT_MAX_WAIT_MS =
1790      3 * 60 * 1000;
1791
1792  /** Time interval between each attempt to connect to NM */
1793  public static final String CLIENT_NM_CONNECT_RETRY_INTERVAL_MS =
1794      YARN_PREFIX + "client.nodemanager-connect.retry-interval-ms";
1795  public static final long DEFAULT_CLIENT_NM_CONNECT_RETRY_INTERVAL_MS
1796      = 10 * 1000;
1797
1798  public static final String YARN_HTTP_POLICY_KEY = YARN_PREFIX + "http.policy";
1799  public static final String YARN_HTTP_POLICY_DEFAULT = HttpConfig.Policy.HTTP_ONLY
1800      .name();
1801  
1802  /**
1803   * Node-labels configurations
1804   */
1805  public static final String NODE_LABELS_PREFIX = YARN_PREFIX + "node-labels.";
1806  
1807  /** URI for NodeLabelManager */
1808  public static final String FS_NODE_LABELS_STORE_ROOT_DIR = NODE_LABELS_PREFIX
1809      + "fs-store.root-dir";
1810  public static final String FS_NODE_LABELS_STORE_RETRY_POLICY_SPEC =
1811      NODE_LABELS_PREFIX + "fs-store.retry-policy-spec";
1812  public static final String DEFAULT_FS_NODE_LABELS_STORE_RETRY_POLICY_SPEC =
1813      "2000, 500";
1814  
1815  /**
1816   * Flag to indicate if the node labels feature enabled, by default it's
1817   * disabled
1818   */
1819  public static final String NODE_LABELS_ENABLED = NODE_LABELS_PREFIX
1820      + "enabled";
1821  public static final boolean DEFAULT_NODE_LABELS_ENABLED = false;
1822
1823  public YarnConfiguration() {
1824    super();
1825  }
1826  
1827  public YarnConfiguration(Configuration conf) {
1828    super(conf);
1829    if (! (conf instanceof YarnConfiguration)) {
1830      this.reloadConfiguration();
1831    }
1832  }
1833
1834  @Private
1835  public static List<String> getServiceAddressConfKeys(Configuration conf) {
1836    return useHttps(conf) ? RM_SERVICES_ADDRESS_CONF_KEYS_HTTPS
1837        : RM_SERVICES_ADDRESS_CONF_KEYS_HTTP;
1838  }
1839
1840  /**
1841   * Get the socket address for <code>name</code> property as a
1842   * <code>InetSocketAddress</code>. On a HA cluster,
1843   * this fetches the address corresponding to the RM identified by
1844   * {@link #RM_HA_ID}.
1845   * @param name property name.
1846   * @param defaultAddress the default value
1847   * @param defaultPort the default port
1848   * @return InetSocketAddress
1849   */
1850  @Override
1851  public InetSocketAddress getSocketAddr(
1852      String name, String defaultAddress, int defaultPort) {
1853    String address;
1854    if (HAUtil.isHAEnabled(this) && getServiceAddressConfKeys(this).contains(name)) {
1855      address = HAUtil.getConfValueForRMInstance(name, defaultAddress, this);
1856    } else {
1857      address = get(name, defaultAddress);
1858    }
1859    return NetUtils.createSocketAddr(address, defaultPort, name);
1860  }
1861
1862  @Override
1863  public InetSocketAddress updateConnectAddr(String name,
1864                                             InetSocketAddress addr) {
1865    String prefix = name;
1866    if (HAUtil.isHAEnabled(this)) {
1867      prefix = HAUtil.addSuffix(prefix, HAUtil.getRMHAId(this));
1868    }
1869    return super.updateConnectAddr(prefix, addr);
1870  }
1871
1872  @Private
1873  public static int getRMDefaultPortNumber(String addressPrefix,
1874      Configuration conf) {
1875    if (addressPrefix.equals(YarnConfiguration.RM_ADDRESS)) {
1876      return YarnConfiguration.DEFAULT_RM_PORT;
1877    } else if (addressPrefix.equals(YarnConfiguration.RM_SCHEDULER_ADDRESS)) {
1878      return YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT;
1879    } else if (addressPrefix.equals(YarnConfiguration.RM_WEBAPP_ADDRESS)) {
1880      return YarnConfiguration.DEFAULT_RM_WEBAPP_PORT;
1881    } else if (addressPrefix.equals(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS)) {
1882      return YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT;
1883    } else if (addressPrefix
1884        .equals(YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS)) {
1885      return YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_PORT;
1886    } else if (addressPrefix.equals(YarnConfiguration.RM_ADMIN_ADDRESS)) {
1887      return YarnConfiguration.DEFAULT_RM_ADMIN_PORT;
1888    } else {
1889      throw new HadoopIllegalArgumentException(
1890          "Invalid RM RPC address Prefix: " + addressPrefix
1891              + ". The valid value should be one of "
1892              + getServiceAddressConfKeys(conf));
1893    }
1894  }
1895
1896  public static boolean useHttps(Configuration conf) {
1897    return HttpConfig.Policy.HTTPS_ONLY == HttpConfig.Policy.fromString(conf
1898        .get(YARN_HTTP_POLICY_KEY,
1899            YARN_HTTP_POLICY_DEFAULT));
1900  }
1901
1902  public static boolean shouldRMFailFast(Configuration conf) {
1903    return conf.getBoolean(YarnConfiguration.RM_FAIL_FAST,
1904        conf.getBoolean(YarnConfiguration.YARN_FAIL_FAST,
1905            YarnConfiguration.DEFAULT_YARN_FAIL_FAST));
1906  }
1907
1908  @Private
1909  public static String getClusterId(Configuration conf) {
1910    String clusterId = conf.get(YarnConfiguration.RM_CLUSTER_ID);
1911    if (clusterId == null) {
1912      throw new HadoopIllegalArgumentException("Configuration doesn't specify " +
1913          YarnConfiguration.RM_CLUSTER_ID);
1914    }
1915    return clusterId;
1916  }
1917}