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.ha.ActiveStandbyElector;
033import org.apache.hadoop.http.HttpConfig;
034import org.apache.hadoop.net.NetUtils;
035import org.apache.hadoop.util.StringUtils;
036import org.apache.hadoop.yarn.api.ApplicationConstants;
037
038@Public
039@Evolving
040public class YarnConfiguration extends Configuration {
041
042  @Private
043  public static final String DR_CONFIGURATION_FILE= "dynamic-resources.xml";
044
045  @Private
046  public static final String CS_CONFIGURATION_FILE= "capacity-scheduler.xml";
047
048  @Private
049  public static final String HADOOP_POLICY_CONFIGURATION_FILE =
050      "hadoop-policy.xml";
051
052  @Private
053  public static final String YARN_SITE_CONFIGURATION_FILE = "yarn-site.xml";
054
055  private static final String YARN_DEFAULT_CONFIGURATION_FILE =
056      "yarn-default.xml";
057
058  @Private
059  public static final String CORE_SITE_CONFIGURATION_FILE = "core-site.xml";
060
061  @Private
062  public static final List<String> RM_CONFIGURATION_FILES =
063      Collections.unmodifiableList(Arrays.asList(
064          DR_CONFIGURATION_FILE,
065          CS_CONFIGURATION_FILE,
066          HADOOP_POLICY_CONFIGURATION_FILE,
067          YARN_SITE_CONFIGURATION_FILE,
068          CORE_SITE_CONFIGURATION_FILE));
069
070  @Evolving
071  public static final int APPLICATION_MAX_TAGS = 10;
072
073  @Evolving
074  public static final int APPLICATION_MAX_TAG_LENGTH = 100;
075
076  static {
077    addDeprecatedKeys();
078    Configuration.addDefaultResource(YARN_DEFAULT_CONFIGURATION_FILE);
079    Configuration.addDefaultResource(YARN_SITE_CONFIGURATION_FILE);
080  }
081
082  private static void addDeprecatedKeys() {
083    Configuration.addDeprecations(new DeprecationDelta[] {
084        new DeprecationDelta("yarn.client.max-nodemanagers-proxies",
085            NM_CLIENT_MAX_NM_PROXIES)
086    });
087  }
088
089  //Configurations
090
091  public static final String YARN_PREFIX = "yarn.";
092
093  /** Delay before deleting resource to ease debugging of NM issues */
094  public static final String DEBUG_NM_DELETE_DELAY_SEC =
095    YarnConfiguration.NM_PREFIX + "delete.debug-delay-sec";
096
097  public static final String NM_LOG_CONTAINER_DEBUG_INFO =
098      YarnConfiguration.NM_PREFIX + "log-container-debug-info.enabled";
099
100  public static final boolean DEFAULT_NM_LOG_CONTAINER_DEBUG_INFO = false;
101  
102  ////////////////////////////////
103  // IPC Configs
104  ////////////////////////////////
105  public static final String IPC_PREFIX = YARN_PREFIX + "ipc.";
106
107  /** Factory to create client IPC classes.*/
108  public static final String IPC_CLIENT_FACTORY_CLASS =
109    IPC_PREFIX + "client.factory.class";
110  public static final String DEFAULT_IPC_CLIENT_FACTORY_CLASS = 
111      "org.apache.hadoop.yarn.factories.impl.pb.RpcClientFactoryPBImpl";
112
113  /** Factory to create server IPC classes.*/
114  public static final String IPC_SERVER_FACTORY_CLASS = 
115    IPC_PREFIX + "server.factory.class";
116  public static final String DEFAULT_IPC_SERVER_FACTORY_CLASS = 
117      "org.apache.hadoop.yarn.factories.impl.pb.RpcServerFactoryPBImpl";
118
119  /** Factory to create serializeable records.*/
120  public static final String IPC_RECORD_FACTORY_CLASS = 
121    IPC_PREFIX + "record.factory.class";
122  public static final String DEFAULT_IPC_RECORD_FACTORY_CLASS = 
123      "org.apache.hadoop.yarn.factories.impl.pb.RecordFactoryPBImpl";
124
125  /** RPC class implementation*/
126  public static final String IPC_RPC_IMPL =
127    IPC_PREFIX + "rpc.class";
128  public static final String DEFAULT_IPC_RPC_IMPL = 
129    "org.apache.hadoop.yarn.ipc.HadoopYarnProtoRPC";
130  
131  ////////////////////////////////
132  // Resource Manager Configs
133  ////////////////////////////////
134  public static final String RM_PREFIX = "yarn.resourcemanager.";
135
136  public static final String RM_CLUSTER_ID = RM_PREFIX + "cluster-id";
137
138  public static final String RM_HOSTNAME = RM_PREFIX + "hostname";
139
140  /** The address of the applications manager interface in the RM.*/
141  public static final String RM_ADDRESS = 
142    RM_PREFIX + "address";
143  public static final int DEFAULT_RM_PORT = 8032;
144  public static final String DEFAULT_RM_ADDRESS =
145    "0.0.0.0:" + DEFAULT_RM_PORT;
146
147  /** The actual bind address for the RM.*/
148  public static final String RM_BIND_HOST =
149    RM_PREFIX + "bind-host";
150
151  /** The number of threads used to handle applications manager requests.*/
152  public static final String RM_CLIENT_THREAD_COUNT =
153    RM_PREFIX + "client.thread-count";
154  public static final int DEFAULT_RM_CLIENT_THREAD_COUNT = 50;
155
156  /** Number of threads used to launch/cleanup AM.*/
157  public static final String RM_AMLAUNCHER_THREAD_COUNT =
158      RM_PREFIX + "amlauncher.thread-count";
159  public static final int DEFAULT_RM_AMLAUNCHER_THREAD_COUNT = 50;
160
161  /** Retry times to connect with NM.*/
162  public static final String RM_NODEMANAGER_CONNECT_RETRIES =
163      RM_PREFIX + "nodemanager-connect-retries";
164  public static final int DEFAULT_RM_NODEMANAGER_CONNECT_RETRIES = 10;
165
166  /** The Kerberos principal for the resource manager.*/
167  public static final String RM_PRINCIPAL =
168    RM_PREFIX + "principal";
169  
170  /** The address of the scheduler interface.*/
171  public static final String RM_SCHEDULER_ADDRESS = 
172    RM_PREFIX + "scheduler.address";
173  public static final int DEFAULT_RM_SCHEDULER_PORT = 8030;
174  public static final String DEFAULT_RM_SCHEDULER_ADDRESS = "0.0.0.0:" +
175    DEFAULT_RM_SCHEDULER_PORT;
176
177  /** Miniumum request grant-able by the RM scheduler. */
178  public static final String RM_SCHEDULER_MINIMUM_ALLOCATION_MB =
179    YARN_PREFIX + "scheduler.minimum-allocation-mb";
180  public static final int DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_MB = 1024;
181  public static final String RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES =
182      YARN_PREFIX + "scheduler.minimum-allocation-vcores";
183    public static final int DEFAULT_RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES = 1;
184
185  /** Maximum request grant-able by the RM scheduler. */
186  public static final String RM_SCHEDULER_MAXIMUM_ALLOCATION_MB =
187    YARN_PREFIX + "scheduler.maximum-allocation-mb";
188  public static final int DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_MB = 8192;
189  public static final String RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES =
190      YARN_PREFIX + "scheduler.maximum-allocation-vcores";
191  public static final int DEFAULT_RM_SCHEDULER_MAXIMUM_ALLOCATION_VCORES = 4;
192
193  /** Number of threads to handle scheduler interface.*/
194  public static final String RM_SCHEDULER_CLIENT_THREAD_COUNT =
195    RM_PREFIX + "scheduler.client.thread-count";
196  public static final int DEFAULT_RM_SCHEDULER_CLIENT_THREAD_COUNT = 50;
197
198  /** If the port should be included or not in the node name. The node name
199   * is used by the scheduler for resource requests allocation location 
200   * matching. Typically this is just the hostname, using the port is needed
201   * when using minicluster and specific NM are required.*/
202  public static final String RM_SCHEDULER_INCLUDE_PORT_IN_NODE_NAME =
203      YARN_PREFIX + "scheduler.include-port-in-node-name";
204  public static final boolean DEFAULT_RM_SCHEDULER_USE_PORT_FOR_NODE_NAME = 
205      false;
206
207  /** Enable Resource Manager webapp ui actions */
208  public static final String RM_WEBAPP_UI_ACTIONS_ENABLED =
209    RM_PREFIX + "webapp.ui-actions.enabled";
210  public static final boolean DEFAULT_RM_WEBAPP_UI_ACTIONS_ENABLED =
211    true;
212
213  /** Whether the RM should enable Reservation System */
214  public static final String RM_RESERVATION_SYSTEM_ENABLE = RM_PREFIX
215      + "reservation-system.enable";
216  public static final boolean DEFAULT_RM_RESERVATION_SYSTEM_ENABLE = false;
217
218  /** The class to use as the Reservation System. */
219  public static final String RM_RESERVATION_SYSTEM_CLASS = RM_PREFIX
220      + "reservation-system.class";
221
222  /** The PlanFollower for the Reservation System. */
223  public static final String RM_RESERVATION_SYSTEM_PLAN_FOLLOWER = RM_PREFIX
224      + "reservation-system.plan.follower";
225
226  /** The step size of the Reservation System. */
227  public static final String RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP =
228      RM_PREFIX + "reservation-system.planfollower.time-step";
229  public static final long DEFAULT_RM_RESERVATION_SYSTEM_PLAN_FOLLOWER_TIME_STEP =
230      1000L;
231
232  /**
233   * Enable periodic monitor threads.
234   * @see #RM_SCHEDULER_MONITOR_POLICIES
235   */
236  public static final String RM_SCHEDULER_ENABLE_MONITORS =
237    RM_PREFIX + "scheduler.monitor.enable";
238  public static final boolean DEFAULT_RM_SCHEDULER_ENABLE_MONITORS = false;
239
240  /** List of SchedulingEditPolicy classes affecting the scheduler. */
241  public static final String RM_SCHEDULER_MONITOR_POLICIES =
242    RM_PREFIX + "scheduler.monitor.policies";
243
244  /** The address of the RM web application.*/
245  public static final String RM_WEBAPP_ADDRESS = 
246    RM_PREFIX + "webapp.address";
247
248  public static final int DEFAULT_RM_WEBAPP_PORT = 8088;
249  public static final String DEFAULT_RM_WEBAPP_ADDRESS = "0.0.0.0:" +
250    DEFAULT_RM_WEBAPP_PORT;
251  
252  /** The https address of the RM web application.*/
253  public static final String RM_WEBAPP_HTTPS_ADDRESS =
254      RM_PREFIX + "webapp.https.address";
255  public static final boolean YARN_SSL_CLIENT_HTTPS_NEED_AUTH_DEFAULT = false;
256  public static final String YARN_SSL_SERVER_RESOURCE_DEFAULT = "ssl-server.xml";
257  
258  public static final int DEFAULT_RM_WEBAPP_HTTPS_PORT = 8090;
259  public static final String DEFAULT_RM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
260      + DEFAULT_RM_WEBAPP_HTTPS_PORT;
261  
262  public static final String RM_RESOURCE_TRACKER_ADDRESS =
263    RM_PREFIX + "resource-tracker.address";
264  public static final int DEFAULT_RM_RESOURCE_TRACKER_PORT = 8031;
265  public static final String DEFAULT_RM_RESOURCE_TRACKER_ADDRESS =
266    "0.0.0.0:" + DEFAULT_RM_RESOURCE_TRACKER_PORT;
267
268  /** The expiry interval for application master reporting.*/
269  public static final String RM_AM_EXPIRY_INTERVAL_MS = 
270    YARN_PREFIX  + "am.liveness-monitor.expiry-interval-ms";
271  public static final int DEFAULT_RM_AM_EXPIRY_INTERVAL_MS = 600000;
272
273  /** How long to wait until a node manager is considered dead.*/
274  public static final String RM_NM_EXPIRY_INTERVAL_MS = 
275    YARN_PREFIX + "nm.liveness-monitor.expiry-interval-ms";
276  public static final int DEFAULT_RM_NM_EXPIRY_INTERVAL_MS = 600000;
277
278  /** Are acls enabled.*/
279  public static final String YARN_ACL_ENABLE = 
280    YARN_PREFIX + "acl.enable";
281  public static final boolean DEFAULT_YARN_ACL_ENABLE = false;
282
283  /** Are reservation acls enabled.*/
284  public static final String YARN_RESERVATION_ACL_ENABLE =
285          YARN_PREFIX + "acl.reservation-enable";
286  public static final boolean DEFAULT_YARN_RESERVATION_ACL_ENABLE = false;
287
288  /** ACL of who can be admin of YARN cluster.*/
289  public static final String YARN_ADMIN_ACL = 
290    YARN_PREFIX + "admin.acl";
291  public static final String DEFAULT_YARN_ADMIN_ACL = "*";
292  
293  /** ACL used in case none is found. Allows nothing. */
294  public static final String DEFAULT_YARN_APP_ACL = " ";
295
296  /**
297   * Enable/disable intermediate-data encryption at YARN level. For now, this
298   * only is used by the FileSystemRMStateStore to setup right file-system
299   * security attributes.
300   */
301  @Private
302  public static final String YARN_INTERMEDIATE_DATA_ENCRYPTION = YARN_PREFIX
303      + "intermediate-data-encryption.enable";
304
305  @Private
306  public static final boolean DEFAULT_YARN_INTERMEDIATE_DATA_ENCRYPTION = false;
307
308  /** The address of the RM admin interface.*/
309  public static final String RM_ADMIN_ADDRESS = 
310    RM_PREFIX + "admin.address";
311  public static final int DEFAULT_RM_ADMIN_PORT = 8033;
312  public static final String DEFAULT_RM_ADMIN_ADDRESS = "0.0.0.0:" +
313      DEFAULT_RM_ADMIN_PORT;
314  
315  /**Number of threads used to handle RM admin interface.*/
316  public static final String RM_ADMIN_CLIENT_THREAD_COUNT =
317    RM_PREFIX + "admin.client.thread-count";
318  public static final int DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT = 1;
319  
320  /**
321   * The maximum number of application attempts.
322   * It's a global setting for all application masters.
323   */
324  public static final String RM_AM_MAX_ATTEMPTS =
325    RM_PREFIX + "am.max-attempts";
326  public static final int DEFAULT_RM_AM_MAX_ATTEMPTS = 2;
327  
328  /** The keytab for the resource manager.*/
329  public static final String RM_KEYTAB = 
330    RM_PREFIX + "keytab";
331
332  /**The kerberos principal to be used for spnego filter for RM.*/
333  public static final String RM_WEBAPP_SPNEGO_USER_NAME_KEY =
334      RM_PREFIX + "webapp.spnego-principal";
335  
336  /**The kerberos keytab to be used for spnego filter for RM.*/
337  public static final String RM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY =
338      RM_PREFIX + "webapp.spnego-keytab-file";
339
340  /**
341   * Flag to enable override of the default kerberos authentication filter with
342   * the RM authentication filter to allow authentication using delegation
343   * tokens(fallback to kerberos if the tokens are missing). Only applicable
344   * when the http authentication type is kerberos.
345   */
346  public static final String RM_WEBAPP_DELEGATION_TOKEN_AUTH_FILTER = RM_PREFIX
347      + "webapp.delegation-token-auth-filter.enabled";
348  public static final boolean DEFAULT_RM_WEBAPP_DELEGATION_TOKEN_AUTH_FILTER =
349      true;
350
351  /** Enable cross origin (CORS) support. **/
352  public static final String RM_WEBAPP_ENABLE_CORS_FILTER =
353      RM_PREFIX + "webapp.cross-origin.enabled";
354  public static final boolean DEFAULT_RM_WEBAPP_ENABLE_CORS_FILTER = false;
355
356  /** How long to wait until a container is considered dead.*/
357  public static final String RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS = 
358    RM_PREFIX + "rm.container-allocation.expiry-interval-ms";
359  public static final int DEFAULT_RM_CONTAINER_ALLOC_EXPIRY_INTERVAL_MS = 600000;
360  
361  /** Path to file with nodes to include.*/
362  public static final String RM_NODES_INCLUDE_FILE_PATH = 
363    RM_PREFIX + "nodes.include-path";
364  public static final String DEFAULT_RM_NODES_INCLUDE_FILE_PATH = "";
365  
366  /** Path to file with nodes to exclude.*/
367  public static final String RM_NODES_EXCLUDE_FILE_PATH = 
368    RM_PREFIX + "nodes.exclude-path";
369  public static final String DEFAULT_RM_NODES_EXCLUDE_FILE_PATH = "";
370  
371  /** Number of threads to handle resource tracker calls.*/
372  public static final String RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT =
373    RM_PREFIX + "resource-tracker.client.thread-count";
374  public static final int DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT = 50;
375  
376  /** The class to use as the resource scheduler.*/
377  public static final String RM_SCHEDULER = 
378    RM_PREFIX + "scheduler.class";
379 
380  public static final String DEFAULT_RM_SCHEDULER = 
381      "org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler";
382
383  /** RM set next Heartbeat interval for NM */
384  public static final String RM_NM_HEARTBEAT_INTERVAL_MS =
385      RM_PREFIX + "nodemanagers.heartbeat-interval-ms";
386  public static final long DEFAULT_RM_NM_HEARTBEAT_INTERVAL_MS = 1000;
387
388  /** Number of worker threads that write the history data. */
389  public static final String RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE =
390      RM_PREFIX + "history-writer.multi-threaded-dispatcher.pool-size";
391  public static final int DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE =
392      10;
393
394  /**
395   *  The setting that controls whether yarn system metrics is published on the
396   *  timeline server or not by RM.
397   */
398  public static final String RM_SYSTEM_METRICS_PUBLISHER_ENABLED =
399      RM_PREFIX + "system-metrics-publisher.enabled";
400  public static final boolean DEFAULT_RM_SYSTEM_METRICS_PUBLISHER_ENABLED = false;
401
402  public static final String RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE =
403      RM_PREFIX + "system-metrics-publisher.dispatcher.pool-size";
404  public static final int DEFAULT_RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE =
405      10;
406
407  //RM delegation token related keys
408  public static final String RM_DELEGATION_KEY_UPDATE_INTERVAL_KEY =
409    RM_PREFIX + "delegation.key.update-interval";
410  public static final long RM_DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT =
411    24*60*60*1000; // 1 day
412  public static final String RM_DELEGATION_TOKEN_RENEW_INTERVAL_KEY =
413    RM_PREFIX + "delegation.token.renew-interval";
414  public static final long RM_DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT =
415    24*60*60*1000;  // 1 day
416  public static final String RM_DELEGATION_TOKEN_MAX_LIFETIME_KEY =
417     RM_PREFIX + "delegation.token.max-lifetime";
418  public static final long RM_DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT =
419    7*24*60*60*1000; // 7 days
420  
421  public static final String RECOVERY_ENABLED = RM_PREFIX + "recovery.enabled";
422  public static final boolean DEFAULT_RM_RECOVERY_ENABLED = false;
423
424  public static final String YARN_FAIL_FAST = YARN_PREFIX + "fail-fast";
425  public static final boolean DEFAULT_YARN_FAIL_FAST = false;
426
427  public static final String RM_FAIL_FAST = RM_PREFIX + "fail-fast";
428
429  @Private
430  public static final String RM_WORK_PRESERVING_RECOVERY_ENABLED = RM_PREFIX
431      + "work-preserving-recovery.enabled";
432  @Private
433  public static final boolean DEFAULT_RM_WORK_PRESERVING_RECOVERY_ENABLED =
434      true;
435
436  public static final String RM_WORK_PRESERVING_RECOVERY_SCHEDULING_WAIT_MS =
437      RM_PREFIX + "work-preserving-recovery.scheduling-wait-ms";
438  public static final long DEFAULT_RM_WORK_PRESERVING_RECOVERY_SCHEDULING_WAIT_MS =
439      10000;
440
441  /** Zookeeper interaction configs */
442  public static final String RM_ZK_PREFIX = RM_PREFIX + "zk-";
443
444  public static final String RM_ZK_ADDRESS = RM_ZK_PREFIX + "address";
445
446  public static final String RM_ZK_NUM_RETRIES = RM_ZK_PREFIX + "num-retries";
447  public static final int DEFAULT_ZK_RM_NUM_RETRIES = 1000;
448
449  public static final String RM_ZK_RETRY_INTERVAL_MS =
450      RM_ZK_PREFIX + "retry-interval-ms";
451  public static final int DEFAULT_RM_ZK_RETRY_INTERVAL_MS = 1000;
452
453  public static final String RM_ZK_TIMEOUT_MS = RM_ZK_PREFIX + "timeout-ms";
454  public static final int DEFAULT_RM_ZK_TIMEOUT_MS = 10000;
455
456  public static final String RM_ZK_ACL = RM_ZK_PREFIX + "acl";
457  public static final String DEFAULT_RM_ZK_ACL = "world:anyone:rwcda";
458
459  public static final String RM_ZK_AUTH = RM_ZK_PREFIX + "auth";
460
461  public static final String ZK_STATE_STORE_PREFIX =
462      RM_PREFIX + "zk-state-store.";
463
464  /** Parent znode path under which ZKRMStateStore will create znodes */
465  public static final String ZK_RM_STATE_STORE_PARENT_PATH =
466      ZK_STATE_STORE_PREFIX + "parent-path";
467  public static final String DEFAULT_ZK_RM_STATE_STORE_PARENT_PATH = "/rmstore";
468
469  /** Root node ACLs for fencing */
470  public static final String ZK_RM_STATE_STORE_ROOT_NODE_ACL =
471      ZK_STATE_STORE_PREFIX + "root-node.acl";
472
473  /** HA related configs */
474  public static final String RM_HA_PREFIX = RM_PREFIX + "ha.";
475  public static final String RM_HA_ENABLED = RM_HA_PREFIX + "enabled";
476  public static final boolean DEFAULT_RM_HA_ENABLED = false;
477
478  public static final String RM_HA_IDS = RM_HA_PREFIX + "rm-ids";
479  public static final String RM_HA_ID = RM_HA_PREFIX + "id";
480
481  /** Store the related configuration files in File System */
482  public static final String FS_BASED_RM_CONF_STORE = RM_PREFIX
483      + "configuration.file-system-based-store";
484  public static final String DEFAULT_FS_BASED_RM_CONF_STORE = "/yarn/conf";
485
486  public static final String RM_CONFIGURATION_PROVIDER_CLASS = RM_PREFIX
487      + "configuration.provider-class";
488  public static final String DEFAULT_RM_CONFIGURATION_PROVIDER_CLASS =
489      "org.apache.hadoop.yarn.LocalConfigurationProvider";
490
491  public static final String YARN_AUTHORIZATION_PROVIDER = YARN_PREFIX
492      + "authorization-provider";
493  private static final List<String> RM_SERVICES_ADDRESS_CONF_KEYS_HTTP =
494      Collections.unmodifiableList(Arrays.asList(
495          RM_ADDRESS,
496          RM_SCHEDULER_ADDRESS,
497          RM_ADMIN_ADDRESS,
498          RM_RESOURCE_TRACKER_ADDRESS,
499          RM_WEBAPP_ADDRESS));
500
501  private static final List<String> RM_SERVICES_ADDRESS_CONF_KEYS_HTTPS =
502      Collections.unmodifiableList(Arrays.asList(
503          RM_ADDRESS,
504          RM_SCHEDULER_ADDRESS,
505          RM_ADMIN_ADDRESS,
506          RM_RESOURCE_TRACKER_ADDRESS,
507          RM_WEBAPP_HTTPS_ADDRESS));
508
509  public static final String AUTO_FAILOVER_PREFIX =
510      RM_HA_PREFIX + "automatic-failover.";
511
512  public static final String AUTO_FAILOVER_ENABLED =
513      AUTO_FAILOVER_PREFIX + "enabled";
514  public static final boolean DEFAULT_AUTO_FAILOVER_ENABLED = true;
515
516  public static final String AUTO_FAILOVER_EMBEDDED =
517      AUTO_FAILOVER_PREFIX + "embedded";
518  public static final boolean DEFAULT_AUTO_FAILOVER_EMBEDDED = true;
519
520  public static final String AUTO_FAILOVER_ZK_BASE_PATH =
521      AUTO_FAILOVER_PREFIX + "zk-base-path";
522  public static final String DEFAULT_AUTO_FAILOVER_ZK_BASE_PATH =
523      "/yarn-leader-election";
524
525  public static final String CLIENT_FAILOVER_PREFIX =
526      YARN_PREFIX + "client.failover-";
527  public static final String CLIENT_FAILOVER_PROXY_PROVIDER =
528      CLIENT_FAILOVER_PREFIX + "proxy-provider";
529  public static final String DEFAULT_CLIENT_FAILOVER_PROXY_PROVIDER =
530      "org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider";
531
532  public static final String CLIENT_FAILOVER_MAX_ATTEMPTS =
533      CLIENT_FAILOVER_PREFIX + "max-attempts";
534
535  public static final String CLIENT_FAILOVER_SLEEPTIME_BASE_MS =
536      CLIENT_FAILOVER_PREFIX + "sleep-base-ms";
537
538  public static final String CLIENT_FAILOVER_SLEEPTIME_MAX_MS =
539      CLIENT_FAILOVER_PREFIX + "sleep-max-ms";
540
541  public static final String CLIENT_FAILOVER_RETRIES =
542      CLIENT_FAILOVER_PREFIX + "retries";
543  public static final int DEFAULT_CLIENT_FAILOVER_RETRIES = 0;
544
545  public static final String CLIENT_FAILOVER_RETRIES_ON_SOCKET_TIMEOUTS =
546      CLIENT_FAILOVER_PREFIX + "retries-on-socket-timeouts";
547  public static final int
548      DEFAULT_CLIENT_FAILOVER_RETRIES_ON_SOCKET_TIMEOUTS = 0;
549
550  /** number of zookeeper operation retry times in ActiveStandbyElector */
551  public static final String RM_HA_FC_ELECTOR_ZK_RETRIES_KEY = RM_HA_PREFIX
552      + "failover-controller.active-standby-elector.zk.retries";
553
554
555  /**
556   * Whether to use curator-based elector for leader election.
557   *
558   * Deprecated Eventually, we want to default to the curator-based
559   * implementation and remove the {@link ActiveStandbyElector} based
560   * implementation. We should remove this config then.
561   */
562  @Unstable
563  @Deprecated
564  public static final String CURATOR_LEADER_ELECTOR =
565      RM_HA_PREFIX + "curator-leader-elector.enabled";
566  @Private
567  @Unstable
568  public static final boolean DEFAULT_CURATOR_LEADER_ELECTOR_ENABLED = false;
569
570  ////////////////////////////////
571  // RM state store configs
572  ////////////////////////////////
573  /** The class to use as the persistent store.*/
574  public static final String RM_STORE = RM_PREFIX + "store.class";
575  
576  /** URI for FileSystemRMStateStore */
577  public static final String FS_RM_STATE_STORE_URI = RM_PREFIX
578      + "fs.state-store.uri";
579  public static final String FS_RM_STATE_STORE_RETRY_POLICY_SPEC = RM_PREFIX
580      + "fs.state-store.retry-policy-spec";
581  public static final String DEFAULT_FS_RM_STATE_STORE_RETRY_POLICY_SPEC =
582      "2000, 500";
583
584  public static final String FS_RM_STATE_STORE_NUM_RETRIES =
585      RM_PREFIX + "fs.state-store.num-retries";
586  public static final int DEFAULT_FS_RM_STATE_STORE_NUM_RETRIES = 0;
587
588  public static final String FS_RM_STATE_STORE_RETRY_INTERVAL_MS =
589      RM_PREFIX + "fs.state-store.retry-interval-ms";
590  public static final long DEFAULT_FS_RM_STATE_STORE_RETRY_INTERVAL_MS =
591      1000L;
592
593  public static final String RM_LEVELDB_STORE_PATH = RM_PREFIX
594      + "leveldb-state-store.path";
595
596  /** The time in seconds between full compactions of the leveldb database.
597   *  Setting the interval to zero disables the full compaction cycles.
598   */
599  public static final String RM_LEVELDB_COMPACTION_INTERVAL_SECS = RM_PREFIX
600      + "leveldb-state-store.compaction-interval-secs";
601  public static final long DEFAULT_RM_LEVELDB_COMPACTION_INTERVAL_SECS = 3600;
602
603  /** The maximum number of completed applications RM keeps. */ 
604  public static final String RM_MAX_COMPLETED_APPLICATIONS =
605    RM_PREFIX + "max-completed-applications";
606  public static final int DEFAULT_RM_MAX_COMPLETED_APPLICATIONS = 10000;
607
608  /**
609   * The maximum number of completed applications RM state store keeps, by
610   * default equals to DEFAULT_RM_MAX_COMPLETED_APPLICATIONS
611   */
612  public static final String RM_STATE_STORE_MAX_COMPLETED_APPLICATIONS =
613      RM_PREFIX + "state-store.max-completed-applications";
614  public static final int DEFAULT_RM_STATE_STORE_MAX_COMPLETED_APPLICATIONS =
615      DEFAULT_RM_MAX_COMPLETED_APPLICATIONS;
616
617  /** Default application name */
618  public static final String DEFAULT_APPLICATION_NAME = "N/A";
619
620  /** Default application type */
621  public static final String DEFAULT_APPLICATION_TYPE = "YARN";
622
623  /** Default application type length */
624  public static final int APPLICATION_TYPE_LENGTH = 20;
625  
626  /** Default queue name */
627  public static final String DEFAULT_QUEUE_NAME = "default";
628
629  /**
630   * Buckets (in minutes) for the number of apps running in each queue.
631   */
632  public static final String RM_METRICS_RUNTIME_BUCKETS =
633    RM_PREFIX + "metrics.runtime.buckets";
634
635  /**
636   * Default sizes of the runtime metric buckets in minutes.
637   */
638  public static final String DEFAULT_RM_METRICS_RUNTIME_BUCKETS = 
639    "60,300,1440";
640
641  public static final String RM_AMRM_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS = RM_PREFIX
642      + "am-rm-tokens.master-key-rolling-interval-secs";
643
644  public static final long DEFAULT_RM_AMRM_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
645      24 * 60 * 60;
646
647  public static final String RM_CONTAINER_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
648      RM_PREFIX + "container-tokens.master-key-rolling-interval-secs";
649
650  public static final long DEFAULT_RM_CONTAINER_TOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
651      24 * 60 * 60;
652
653  public static final String RM_NMTOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
654      RM_PREFIX + "nm-tokens.master-key-rolling-interval-secs";
655  
656  public static final long DEFAULT_RM_NMTOKEN_MASTER_KEY_ROLLING_INTERVAL_SECS =
657      24 * 60 * 60;
658
659  public static final String RM_NODEMANAGER_MINIMUM_VERSION =
660      RM_PREFIX + "nodemanager.minimum.version";
661
662  public static final String DEFAULT_RM_NODEMANAGER_MINIMUM_VERSION =
663      "NONE";
664
665  /**
666   * Timeout(msec) for an untracked node to remain in shutdown or decommissioned
667   * state.
668   */
669  public static final String RM_NODEMANAGER_UNTRACKED_REMOVAL_TIMEOUT_MSEC =
670      RM_PREFIX + "node-removal-untracked.timeout-ms";
671  public static final int
672      DEFAULT_RM_NODEMANAGER_UNTRACKED_REMOVAL_TIMEOUT_MSEC = 60000;
673
674  /**
675   * RM proxy users' prefix
676   */
677  public static final String RM_PROXY_USER_PREFIX = RM_PREFIX + "proxyuser.";
678
679  ////////////////////////////////
680  // Node Manager Configs
681  ////////////////////////////////
682  
683  /** Prefix for all node manager configs.*/
684  public static final String NM_PREFIX = "yarn.nodemanager.";
685
686  /** Environment variables that will be sent to containers.*/
687  public static final String NM_ADMIN_USER_ENV = NM_PREFIX + "admin-env";
688  public static final String DEFAULT_NM_ADMIN_USER_ENV = "MALLOC_ARENA_MAX=$MALLOC_ARENA_MAX";
689
690  /** Environment variables that containers may override rather than use NodeManager's default.*/
691  public static final String NM_ENV_WHITELIST = NM_PREFIX + "env-whitelist";
692  public static final String DEFAULT_NM_ENV_WHITELIST = StringUtils.join(",",
693    Arrays.asList(ApplicationConstants.Environment.JAVA_HOME.key(),
694      ApplicationConstants.Environment.HADOOP_COMMON_HOME.key(),
695      ApplicationConstants.Environment.HADOOP_HDFS_HOME.key(),
696      ApplicationConstants.Environment.HADOOP_CONF_DIR.key(),
697      ApplicationConstants.Environment.CLASSPATH_PREPEND_DISTCACHE.key(),
698      ApplicationConstants.Environment.HADOOP_YARN_HOME.key()));
699  
700  /** address of node manager IPC.*/
701  public static final String NM_ADDRESS = NM_PREFIX + "address";
702  public static final int DEFAULT_NM_PORT = 0;
703  public static final String DEFAULT_NM_ADDRESS = "0.0.0.0:"
704      + DEFAULT_NM_PORT;
705  
706  /** The actual bind address or the NM.*/
707  public static final String NM_BIND_HOST =
708    NM_PREFIX + "bind-host";
709
710  /** who will execute(launch) the containers.*/
711  public static final String NM_CONTAINER_EXECUTOR = 
712    NM_PREFIX + "container-executor.class";
713
714  /**  
715   * Adjustment to make to the container os scheduling priority.
716   * The valid values for this could vary depending on the platform.
717   * On Linux, higher values mean run the containers at a less 
718   * favorable priority than the NM. 
719   * The value specified is an int.
720   */
721  public static final String NM_CONTAINER_EXECUTOR_SCHED_PRIORITY = 
722    NM_PREFIX + "container-executor.os.sched.priority.adjustment";
723  public static final int DEFAULT_NM_CONTAINER_EXECUTOR_SCHED_PRIORITY = 0;
724  
725  /** Number of threads container manager uses.*/
726  public static final String NM_CONTAINER_MGR_THREAD_COUNT =
727    NM_PREFIX + "container-manager.thread-count";
728  public static final int DEFAULT_NM_CONTAINER_MGR_THREAD_COUNT = 20;
729  
730  /** Number of threads used in cleanup.*/
731  public static final String NM_DELETE_THREAD_COUNT = 
732    NM_PREFIX +  "delete.thread-count";
733  public static final int DEFAULT_NM_DELETE_THREAD_COUNT = 4;
734  
735  /** Keytab for NM.*/
736  public static final String NM_KEYTAB = NM_PREFIX + "keytab";
737  
738  /**List of directories to store localized files in.*/
739  public static final String NM_LOCAL_DIRS = NM_PREFIX + "local-dirs";
740  public static final String DEFAULT_NM_LOCAL_DIRS = "/tmp/nm-local-dir";
741
742  /**
743   * Number of files in each localized directories
744   * Avoid tuning this too low. 
745   */
746  public static final String NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY =
747    NM_PREFIX + "local-cache.max-files-per-directory";
748  public static final int DEFAULT_NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY = 8192;
749
750  /** Address where the localizer IPC is.*/
751  public static final String NM_LOCALIZER_ADDRESS =
752    NM_PREFIX + "localizer.address";
753  public static final int DEFAULT_NM_LOCALIZER_PORT = 8040;
754  public static final String DEFAULT_NM_LOCALIZER_ADDRESS = "0.0.0.0:" +
755    DEFAULT_NM_LOCALIZER_PORT;
756  
757  /** Interval in between cache cleanups.*/
758  public static final String NM_LOCALIZER_CACHE_CLEANUP_INTERVAL_MS =
759    NM_PREFIX + "localizer.cache.cleanup.interval-ms";
760  public static final long DEFAULT_NM_LOCALIZER_CACHE_CLEANUP_INTERVAL_MS = 
761    10 * 60 * 1000;
762  
763  /**
764   * Target size of localizer cache in MB, per nodemanager. It is a target
765   * retention size that only includes resources with PUBLIC and PRIVATE
766   * visibility and excludes resources with APPLICATION visibility
767   */
768  public static final String NM_LOCALIZER_CACHE_TARGET_SIZE_MB =
769    NM_PREFIX + "localizer.cache.target-size-mb";
770  public static final long DEFAULT_NM_LOCALIZER_CACHE_TARGET_SIZE_MB = 10 * 1024;
771  
772  /** Number of threads to handle localization requests.*/
773  public static final String NM_LOCALIZER_CLIENT_THREAD_COUNT =
774    NM_PREFIX + "localizer.client.thread-count";
775  public static final int DEFAULT_NM_LOCALIZER_CLIENT_THREAD_COUNT = 5;
776  
777  /** Number of threads to use for localization fetching.*/
778  public static final String NM_LOCALIZER_FETCH_THREAD_COUNT = 
779    NM_PREFIX + "localizer.fetch.thread-count";
780  public static final int DEFAULT_NM_LOCALIZER_FETCH_THREAD_COUNT = 4;
781
782  /** Where to store container logs.*/
783  public static final String NM_LOG_DIRS = NM_PREFIX + "log-dirs";
784  public static final String DEFAULT_NM_LOG_DIRS = "/tmp/logs";
785
786  public static final String NM_RESOURCEMANAGER_MINIMUM_VERSION =
787      NM_PREFIX + "resourcemanager.minimum.version";
788  public static final String DEFAULT_NM_RESOURCEMANAGER_MINIMUM_VERSION = "NONE";
789
790  /** Interval at which the delayed token removal thread runs */
791  public static final String RM_DELAYED_DELEGATION_TOKEN_REMOVAL_INTERVAL_MS =
792      RM_PREFIX + "delayed.delegation-token.removal-interval-ms";
793  public static final long DEFAULT_RM_DELAYED_DELEGATION_TOKEN_REMOVAL_INTERVAL_MS =
794      30000l;
795  
796  /** Delegation Token renewer thread count */
797  public static final String RM_DELEGATION_TOKEN_RENEWER_THREAD_COUNT =
798      RM_PREFIX + "delegation-token-renewer.thread-count";
799  public static final int DEFAULT_RM_DELEGATION_TOKEN_RENEWER_THREAD_COUNT = 50;
800
801  public static final String RM_PROXY_USER_PRIVILEGES_ENABLED = RM_PREFIX
802      + "proxy-user-privileges.enabled";
803  public static final boolean DEFAULT_RM_PROXY_USER_PRIVILEGES_ENABLED = false;
804
805  /** The expiry interval for node IP caching. -1 disables the caching */
806  public static final String RM_NODE_IP_CACHE_EXPIRY_INTERVAL_SECS = RM_PREFIX
807      + "node-ip-cache.expiry-interval-secs";
808  public static final int DEFAULT_RM_NODE_IP_CACHE_EXPIRY_INTERVAL_SECS = -1;
809
810  /**
811   * How many diagnostics/failure messages can be saved in RM for
812   * log aggregation. It also defines the number of diagnostics/failure
813   * messages can be shown in log aggregation web ui.
814   */
815  public static final String RM_MAX_LOG_AGGREGATION_DIAGNOSTICS_IN_MEMORY =
816      RM_PREFIX + "max-log-aggregation-diagnostics-in-memory";
817  public static final int DEFAULT_RM_MAX_LOG_AGGREGATION_DIAGNOSTICS_IN_MEMORY =
818      10;
819
820  /** Whether to enable log aggregation */
821  public static final String LOG_AGGREGATION_ENABLED = YARN_PREFIX
822      + "log-aggregation-enable";
823  public static final boolean DEFAULT_LOG_AGGREGATION_ENABLED = false;
824  
825  /** 
826   * How long to wait before deleting aggregated logs, -1 disables.
827   * Be careful set this too small and you will spam the name node.
828   */
829  public static final String LOG_AGGREGATION_RETAIN_SECONDS = YARN_PREFIX
830      + "log-aggregation.retain-seconds";
831  public static final long DEFAULT_LOG_AGGREGATION_RETAIN_SECONDS = -1;
832  
833  /**
834   * How long to wait between aggregated log retention checks. If set to
835   * a value {@literal <=} 0 then the value is computed as one-tenth of the
836   * log retention setting. Be careful set this too small and you will spam
837   * the name node.
838   */
839  public static final String LOG_AGGREGATION_RETAIN_CHECK_INTERVAL_SECONDS =
840      YARN_PREFIX + "log-aggregation.retain-check-interval-seconds";
841  public static final long DEFAULT_LOG_AGGREGATION_RETAIN_CHECK_INTERVAL_SECONDS = -1;
842
843  /**
844   * How long for ResourceManager to wait for NodeManager to report its
845   * log aggregation status. If waiting time of which the log aggregation status
846   * is reported from NodeManager exceeds the configured value, RM will report
847   * log aggregation status for this NodeManager as TIME_OUT
848   */
849  public static final String LOG_AGGREGATION_STATUS_TIME_OUT_MS =
850      YARN_PREFIX + "log-aggregation-status.time-out.ms";
851  public static final long DEFAULT_LOG_AGGREGATION_STATUS_TIME_OUT_MS
852      = 10 * 60 * 1000;
853
854  /**
855   * Number of seconds to retain logs on the NodeManager. Only applicable if Log
856   * aggregation is disabled
857   */
858  public static final String NM_LOG_RETAIN_SECONDS = NM_PREFIX
859      + "log.retain-seconds";
860  public static final long DEFAULT_NM_LOG_RETAIN_SECONDS = 3 * 60 * 60;
861
862  /**
863   * Define how often NMs wake up and upload log files
864   */
865  public static final String NM_LOG_AGGREGATION_ROLL_MONITORING_INTERVAL_SECONDS =
866      NM_PREFIX + "log-aggregation.roll-monitoring-interval-seconds";
867  public static final long
868      DEFAULT_NM_LOG_AGGREGATION_ROLL_MONITORING_INTERVAL_SECONDS = -1;
869  /**
870   * Number of threads used in log cleanup. Only applicable if Log aggregation
871   * is disabled
872   */
873  public static final String NM_LOG_DELETION_THREADS_COUNT = 
874    NM_PREFIX +  "log.deletion-threads-count";
875  public static final int DEFAULT_NM_LOG_DELETE_THREAD_COUNT = 4;
876
877  /** Where to aggregate logs to.*/
878  public static final String NM_REMOTE_APP_LOG_DIR = 
879    NM_PREFIX + "remote-app-log-dir";
880  public static final String DEFAULT_NM_REMOTE_APP_LOG_DIR = "/tmp/logs";
881
882  /**
883   * The remote log dir will be created at
884   * NM_REMOTE_APP_LOG_DIR/${user}/NM_REMOTE_APP_LOG_DIR_SUFFIX/${appId}
885   */
886  public static final String NM_REMOTE_APP_LOG_DIR_SUFFIX = 
887    NM_PREFIX + "remote-app-log-dir-suffix";
888  public static final String DEFAULT_NM_REMOTE_APP_LOG_DIR_SUFFIX="logs";
889
890  public static final String YARN_LOG_SERVER_URL =
891    YARN_PREFIX + "log.server.url";
892  
893  public static final String YARN_TRACKING_URL_GENERATOR = 
894      YARN_PREFIX + "tracking.url.generator";
895
896  /** Amount of memory in MB that can be allocated for containers.*/
897  public static final String NM_PMEM_MB = NM_PREFIX + "resource.memory-mb";
898  public static final int DEFAULT_NM_PMEM_MB = 8 * 1024;
899
900  /** Amount of memory in MB that has been reserved for non-yarn use. */
901  public static final String NM_SYSTEM_RESERVED_PMEM_MB = NM_PREFIX
902      + "resource.system-reserved-memory-mb";
903
904  /** Specifies whether physical memory check is enabled. */
905  public static final String NM_PMEM_CHECK_ENABLED = NM_PREFIX
906      + "pmem-check-enabled";
907  public static final boolean DEFAULT_NM_PMEM_CHECK_ENABLED = true;
908
909  /** Specifies whether physical memory check is enabled. */
910  public static final String NM_VMEM_CHECK_ENABLED = NM_PREFIX
911      + "vmem-check-enabled";
912  public static final boolean DEFAULT_NM_VMEM_CHECK_ENABLED = true;
913
914  /** Conversion ratio for physical memory to virtual memory. */
915  public static final String NM_VMEM_PMEM_RATIO =
916    NM_PREFIX + "vmem-pmem-ratio";
917  public static final float DEFAULT_NM_VMEM_PMEM_RATIO = 2.1f;
918  
919  /** Number of Virtual CPU Cores which can be allocated for containers.*/
920  public static final String NM_VCORES = NM_PREFIX + "resource.cpu-vcores";
921  public static final int DEFAULT_NM_VCORES = 8;
922
923  /** Count logical processors(like hyperthreads) as cores. */
924  public static final String NM_COUNT_LOGICAL_PROCESSORS_AS_CORES = NM_PREFIX
925      + "resource.count-logical-processors-as-cores";
926  public static final boolean DEFAULT_NM_COUNT_LOGICAL_PROCESSORS_AS_CORES =
927      false;
928
929  /** Multiplier to convert physical cores to vcores. */
930  public static final String NM_PCORES_VCORES_MULTIPLIER = NM_PREFIX
931      + "resource.pcores-vcores-multiplier";
932  public static final float DEFAULT_NM_PCORES_VCORES_MULTIPLIER = 1.0f;
933
934  /** Percentage of overall CPU which can be allocated for containers. */
935  public static final String NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT =
936      NM_PREFIX + "resource.percentage-physical-cpu-limit";
937  public static final int DEFAULT_NM_RESOURCE_PERCENTAGE_PHYSICAL_CPU_LIMIT =
938      100;
939
940  /** Enable or disable node hardware capability detection. */
941  public static final String NM_ENABLE_HARDWARE_CAPABILITY_DETECTION =
942      NM_PREFIX + "resource.detect-hardware-capabilities";
943  public static final boolean DEFAULT_NM_ENABLE_HARDWARE_CAPABILITY_DETECTION =
944      false;
945
946  /**
947   * Prefix for disk configurations. Work in progress: This configuration
948   * parameter may be changed/removed in the future.
949   */
950  @Private
951  public static final String NM_DISK_RESOURCE_PREFIX = NM_PREFIX
952      + "resource.disk.";
953  /**
954   * This setting controls if resource handling for disk operations is enabled.
955   * Work in progress: This configuration parameter may be changed/removed in
956   * the future
957   */
958  @Private
959  public static final String NM_DISK_RESOURCE_ENABLED = NM_DISK_RESOURCE_PREFIX
960      + "enabled";
961  /** Disk as a resource is disabled by default. **/
962  @Private
963  public static final boolean DEFAULT_NM_DISK_RESOURCE_ENABLED = false;
964
965  public static final String NM_NETWORK_RESOURCE_PREFIX = NM_PREFIX
966      + "resource.network.";
967
968  /**
969   * This setting controls if resource handling for network bandwidth is
970   * enabled. Work in progress: This configuration parameter may be
971   * changed/removed in the future
972   */
973  @Private
974  public static final String NM_NETWORK_RESOURCE_ENABLED =
975      NM_NETWORK_RESOURCE_PREFIX + "enabled";
976  /** Network as a resource is disabled by default. **/
977  @Private
978  public static final boolean DEFAULT_NM_NETWORK_RESOURCE_ENABLED = false;
979
980  /**
981   * Specifies the interface to be used for applying network throttling rules.
982   * Work in progress: This configuration parameter may be changed/removed in
983   * the future
984   */
985  @Private
986  public static final String NM_NETWORK_RESOURCE_INTERFACE =
987      NM_NETWORK_RESOURCE_PREFIX + "interface";
988  @Private
989  public static final String DEFAULT_NM_NETWORK_RESOURCE_INTERFACE = "eth0";
990
991  /**
992   * Specifies the total available outbound bandwidth on the node. Work in
993   * progress: This configuration parameter may be changed/removed in the future
994   */
995  @Private
996  public static final String NM_NETWORK_RESOURCE_OUTBOUND_BANDWIDTH_MBIT =
997      NM_NETWORK_RESOURCE_PREFIX + "outbound-bandwidth-mbit";
998  @Private
999  public static final int DEFAULT_NM_NETWORK_RESOURCE_OUTBOUND_BANDWIDTH_MBIT =
1000      1000;
1001
1002  /**
1003   * Specifies the total outbound bandwidth available to YARN containers.
1004   * defaults to NM_NETWORK_RESOURCE_OUTBOUND_BANDWIDTH_MBIT if not specified.
1005   * Work in progress: This configuration parameter may be changed/removed in
1006   * the future
1007   */
1008  @Private
1009  public static final String NM_NETWORK_RESOURCE_OUTBOUND_BANDWIDTH_YARN_MBIT =
1010      NM_NETWORK_RESOURCE_PREFIX + "outbound-bandwidth-yarn-mbit";
1011
1012  /** NM Webapp address.**/
1013  public static final String NM_WEBAPP_ADDRESS = NM_PREFIX + "webapp.address";
1014  public static final int DEFAULT_NM_WEBAPP_PORT = 8042;
1015  public static final String DEFAULT_NM_WEBAPP_ADDRESS = "0.0.0.0:" +
1016    DEFAULT_NM_WEBAPP_PORT;
1017  
1018  /** NM Webapp https address.**/
1019  public static final String NM_WEBAPP_HTTPS_ADDRESS = NM_PREFIX
1020      + "webapp.https.address";
1021  public static final int DEFAULT_NM_WEBAPP_HTTPS_PORT = 8044;
1022  public static final String DEFAULT_NM_WEBAPP_HTTPS_ADDRESS = "0.0.0.0:"
1023      + DEFAULT_NM_WEBAPP_HTTPS_PORT; 
1024
1025  /** Enable/disable CORS filter. */
1026  public static final String NM_WEBAPP_ENABLE_CORS_FILTER =
1027      NM_PREFIX + "webapp.cross-origin.enabled";
1028  public static final boolean DEFAULT_NM_WEBAPP_ENABLE_CORS_FILTER = false;
1029
1030  /** How often to monitor resource in a node.*/
1031  public static final String NM_RESOURCE_MON_INTERVAL_MS =
1032      NM_PREFIX + "resource-monitor.interval-ms";
1033  public static final int DEFAULT_NM_RESOURCE_MON_INTERVAL_MS = 3000;
1034
1035  /** How often to monitor containers.*/
1036  public final static String NM_CONTAINER_MON_INTERVAL_MS =
1037    NM_PREFIX + "container-monitor.interval-ms";
1038  @Deprecated
1039  public final static int DEFAULT_NM_CONTAINER_MON_INTERVAL_MS = 3000;
1040
1041  /** Class that calculates current resource utilization.*/
1042  public static final String NM_MON_RESOURCE_CALCULATOR =
1043      NM_PREFIX + "resource-calculator.class";
1044  /** Class that calculates containers current resource utilization.*/
1045  public static final String NM_CONTAINER_MON_RESOURCE_CALCULATOR =
1046    NM_PREFIX + "container-monitor.resource-calculator.class";
1047  /** Class that calculates process tree resource utilization.*/
1048  public static final String NM_CONTAINER_MON_PROCESS_TREE =
1049    NM_PREFIX + "container-monitor.process-tree.class";
1050  public static final String PROCFS_USE_SMAPS_BASED_RSS_ENABLED = NM_PREFIX +
1051      "container-monitor.procfs-tree.smaps-based-rss.enabled";
1052  public static final boolean DEFAULT_PROCFS_USE_SMAPS_BASED_RSS_ENABLED =
1053      false;
1054
1055  /** Enable/disable container metrics. */
1056  @Private
1057  public static final String NM_CONTAINER_METRICS_ENABLE =
1058      NM_PREFIX + "container-metrics.enable";
1059  @Private
1060  public static final boolean DEFAULT_NM_CONTAINER_METRICS_ENABLE = true;
1061
1062  /** Container metrics flush period. -1 for flush on completion. */
1063  @Private
1064  public static final String NM_CONTAINER_METRICS_PERIOD_MS =
1065      NM_PREFIX + "container-metrics.period-ms";
1066  @Private
1067  public static final int DEFAULT_NM_CONTAINER_METRICS_PERIOD_MS = -1;
1068
1069  /** The delay time ms to unregister container metrics after completion. */
1070  @Private
1071  public static final String NM_CONTAINER_METRICS_UNREGISTER_DELAY_MS =
1072      NM_PREFIX + "container-metrics.unregister-delay-ms";
1073  @Private
1074  public static final int DEFAULT_NM_CONTAINER_METRICS_UNREGISTER_DELAY_MS =
1075      10000;
1076
1077  /** Prefix for all node manager disk health checker configs. */
1078  private static final String NM_DISK_HEALTH_CHECK_PREFIX =
1079      "yarn.nodemanager.disk-health-checker.";
1080  /**
1081   * Enable/Disable disks' health checker. Default is true. An expert level
1082   * configuration property.
1083   */
1084  public static final String NM_DISK_HEALTH_CHECK_ENABLE =
1085      NM_DISK_HEALTH_CHECK_PREFIX + "enable";
1086  /** Frequency of running disks' health checker. */
1087  public static final String NM_DISK_HEALTH_CHECK_INTERVAL_MS =
1088      NM_DISK_HEALTH_CHECK_PREFIX + "interval-ms";
1089  /** By default, disks' health is checked every 2 minutes. */
1090  public static final long DEFAULT_NM_DISK_HEALTH_CHECK_INTERVAL_MS =
1091      2 * 60 * 1000;
1092
1093  /**
1094   * The minimum fraction of number of disks to be healthy for the nodemanager
1095   * to launch new containers. This applies to nm-local-dirs and nm-log-dirs.
1096   */
1097  public static final String NM_MIN_HEALTHY_DISKS_FRACTION =
1098      NM_DISK_HEALTH_CHECK_PREFIX + "min-healthy-disks";
1099  /**
1100   * By default, at least 25% of disks are to be healthy to say that the node is
1101   * healthy in terms of disks.
1102   */
1103  public static final float DEFAULT_NM_MIN_HEALTHY_DISKS_FRACTION = 0.25F;
1104
1105  /**
1106   * The maximum percentage of disk space that can be used after which a disk is
1107   * marked as offline. Values can range from 0.0 to 100.0. If the value is
1108   * greater than or equal to 100, NM will check for full disk. This applies to
1109   * nm-local-dirs and nm-log-dirs.
1110   */
1111  public static final String NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE =
1112      NM_DISK_HEALTH_CHECK_PREFIX + "max-disk-utilization-per-disk-percentage";
1113  /**
1114   * By default, 90% of the disk can be used before it is marked as offline.
1115   */
1116  public static final float DEFAULT_NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE =
1117      90.0F;
1118
1119  /**
1120   * The low threshold percentage of disk space used when an offline disk is
1121   * marked as online. Values can range from 0.0 to 100.0. The value shouldn't
1122   * be more than NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE. If its value is
1123   * more than NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE or not set, it will be
1124   * set to the same value as NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE.
1125   * This applies to nm-local-dirs and nm-log-dirs.
1126   */
1127  public static final String NM_WM_LOW_PER_DISK_UTILIZATION_PERCENTAGE =
1128      NM_DISK_HEALTH_CHECK_PREFIX +
1129      "disk-utilization-watermark-low-per-disk-percentage";
1130
1131  /**
1132   * The minimum space that must be available on a local dir for it to be used.
1133   * This applies to nm-local-dirs and nm-log-dirs.
1134   */
1135  public static final String NM_MIN_PER_DISK_FREE_SPACE_MB =
1136      NM_DISK_HEALTH_CHECK_PREFIX + "min-free-space-per-disk-mb";
1137  /**
1138   * By default, all of the disk can be used before it is marked as offline.
1139   */
1140  public static final long DEFAULT_NM_MIN_PER_DISK_FREE_SPACE_MB = 0;
1141
1142  /** Frequency of running node health script.*/
1143  public static final String NM_HEALTH_CHECK_INTERVAL_MS = 
1144    NM_PREFIX + "health-checker.interval-ms";
1145  public static final long DEFAULT_NM_HEALTH_CHECK_INTERVAL_MS = 10 * 60 * 1000;
1146
1147  /** Health check script time out period.*/  
1148  public static final String NM_HEALTH_CHECK_SCRIPT_TIMEOUT_MS = 
1149    NM_PREFIX + "health-checker.script.timeout-ms";
1150  public static final long DEFAULT_NM_HEALTH_CHECK_SCRIPT_TIMEOUT_MS = 
1151    2 * DEFAULT_NM_HEALTH_CHECK_INTERVAL_MS;
1152  
1153  /** The health check script to run.*/
1154  public static final String NM_HEALTH_CHECK_SCRIPT_PATH = 
1155    NM_PREFIX + "health-checker.script.path";
1156  
1157  /** The arguments to pass to the health check script.*/
1158  public static final String NM_HEALTH_CHECK_SCRIPT_OPTS = 
1159    NM_PREFIX + "health-checker.script.opts";
1160
1161  /** The JVM options used on forking ContainerLocalizer process
1162      by container executor. */
1163  public static final String NM_CONTAINER_LOCALIZER_JAVA_OPTS_KEY =
1164      NM_PREFIX + "container-localizer.java.opts";
1165  public static final String NM_CONTAINER_LOCALIZER_JAVA_OPTS_DEFAULT =
1166      "-Xmx256m";
1167
1168  /** The Docker image name(For DockerContainerExecutor).*/
1169  public static final String NM_DOCKER_CONTAINER_EXECUTOR_IMAGE_NAME =
1170    NM_PREFIX + "docker-container-executor.image-name";
1171
1172  /** The name of the docker executor (For DockerContainerExecutor).*/
1173  public static final String NM_DOCKER_CONTAINER_EXECUTOR_EXEC_NAME =
1174    NM_PREFIX + "docker-container-executor.exec-name";
1175
1176  /** The default docker executor (For DockerContainerExecutor).*/
1177  public static final String NM_DEFAULT_DOCKER_CONTAINER_EXECUTOR_EXEC_NAME =
1178          "/usr/bin/docker";
1179
1180  /** Prefix for runtime configuration constants. */
1181  public static final String LINUX_CONTAINER_RUNTIME_PREFIX = NM_PREFIX +
1182      "runtime.linux.";
1183  public static final String DOCKER_CONTAINER_RUNTIME_PREFIX =
1184      LINUX_CONTAINER_RUNTIME_PREFIX + "docker.";
1185
1186  /** Capabilities allowed (and added by default) for docker containers. **/
1187  public static final String NM_DOCKER_CONTAINER_CAPABILITIES =
1188      DOCKER_CONTAINER_RUNTIME_PREFIX + "capabilities";
1189
1190  /** These are the default capabilities added by docker. We'll use the same
1191   * set here. While these may not be case-sensitive from a docker
1192   * perspective, it is best to keep these uppercase.
1193   */
1194  public static final String[] DEFAULT_NM_DOCKER_CONTAINER_CAPABILITIES = {
1195      "CHOWN",
1196      "DAC_OVERRIDE",
1197      "FSETID",
1198      "FOWNER",
1199      "MKNOD",
1200      "NET_RAW",
1201      "SETGID",
1202      "SETUID",
1203      "SETFCAP",
1204      "SETPCAP",
1205      "NET_BIND_SERVICE",
1206      "SYS_CHROOT",
1207      "KILL",
1208      "AUDIT_WRITE" };
1209
1210  /** Allow privileged containers. Use with extreme care. */
1211  public static final String NM_DOCKER_ALLOW_PRIVILEGED_CONTAINERS =
1212      DOCKER_CONTAINER_RUNTIME_PREFIX + "privileged-containers.allowed";
1213
1214  /** Privileged containers are disabled by default. */
1215  public static final boolean DEFAULT_NM_DOCKER_ALLOW_PRIVILEGED_CONTAINERS =
1216      false;
1217
1218  /** ACL list for users allowed to run privileged containers. */
1219  public static final String NM_DOCKER_PRIVILEGED_CONTAINERS_ACL =
1220      DOCKER_CONTAINER_RUNTIME_PREFIX + "privileged-containers.acl";
1221
1222  /** Default list for users allowed to run privileged containers is empty. */
1223  public static final String DEFAULT_NM_DOCKER_PRIVILEGED_CONTAINERS_ACL = "";
1224
1225  /** The path to the Linux container executor.*/
1226  public static final String NM_LINUX_CONTAINER_EXECUTOR_PATH =
1227    NM_PREFIX + "linux-container-executor.path";
1228  
1229  /** 
1230   * The UNIX group that the linux-container-executor should run as.
1231   * This is intended to be set as part of container-executor.cfg. 
1232   */
1233  public static final String NM_LINUX_CONTAINER_GROUP =
1234    NM_PREFIX + "linux-container-executor.group";
1235
1236  /**
1237   * If linux-container-executor should limit itself to one user
1238   * when running in non-secure mode.
1239   */
1240  public static final String NM_NONSECURE_MODE_LIMIT_USERS= NM_PREFIX +
1241     "linux-container-executor.nonsecure-mode.limit-users";
1242
1243  public static final boolean DEFAULT_NM_NONSECURE_MODE_LIMIT_USERS = true; 
1244
1245  /**
1246   * The UNIX user that containers will run as when Linux-container-executor
1247   * is used in nonsecure mode (a use case for this is using cgroups).
1248   */
1249  public static final String NM_NONSECURE_MODE_LOCAL_USER_KEY = NM_PREFIX +
1250      "linux-container-executor.nonsecure-mode.local-user";
1251
1252  public static final String DEFAULT_NM_NONSECURE_MODE_LOCAL_USER = "nobody";
1253
1254  /**
1255   * The allowed pattern for UNIX user names enforced by 
1256   * Linux-container-executor when used in nonsecure mode (use case for this 
1257   * is using cgroups). The default value is taken from /usr/sbin/adduser
1258   */
1259  public static final String NM_NONSECURE_MODE_USER_PATTERN_KEY = NM_PREFIX +
1260      "linux-container-executor.nonsecure-mode.user-pattern";
1261
1262  public static final String DEFAULT_NM_NONSECURE_MODE_USER_PATTERN = 
1263      "^[_.A-Za-z0-9][-@_.A-Za-z0-9]{0,255}?[$]?$";
1264
1265  /** The type of resource enforcement to use with the
1266   *  linux container executor.
1267   */
1268  public static final String NM_LINUX_CONTAINER_RESOURCES_HANDLER = 
1269  NM_PREFIX + "linux-container-executor.resources-handler.class";
1270  
1271  /** The path the linux container executor should use for cgroups */
1272  public static final String NM_LINUX_CONTAINER_CGROUPS_HIERARCHY =
1273    NM_PREFIX + "linux-container-executor.cgroups.hierarchy";
1274  
1275  /** Whether the linux container executor should mount cgroups if not found */
1276  public static final String NM_LINUX_CONTAINER_CGROUPS_MOUNT =
1277    NM_PREFIX + "linux-container-executor.cgroups.mount";
1278  
1279  /** Where the linux container executor should mount cgroups if not found */
1280  public static final String NM_LINUX_CONTAINER_CGROUPS_MOUNT_PATH =
1281    NM_PREFIX + "linux-container-executor.cgroups.mount-path";
1282
1283  /**
1284   * Whether the apps should run in strict resource usage mode(not allowed to
1285   * use spare CPU)
1286   */
1287  public static final String NM_LINUX_CONTAINER_CGROUPS_STRICT_RESOURCE_USAGE =
1288      NM_PREFIX + "linux-container-executor.cgroups.strict-resource-usage";
1289  public static final boolean DEFAULT_NM_LINUX_CONTAINER_CGROUPS_STRICT_RESOURCE_USAGE =
1290      false;
1291
1292
1293
1294  /**
1295   * Interval of time the linux container executor should try cleaning up
1296   * cgroups entry when cleaning up a container. This is required due to what 
1297   * it seems a race condition because the SIGTERM/SIGKILL is asynch.
1298   */
1299  public static final String NM_LINUX_CONTAINER_CGROUPS_DELETE_TIMEOUT =
1300   NM_PREFIX + "linux-container-executor.cgroups.delete-timeout-ms";
1301
1302  public static final long DEFAULT_NM_LINUX_CONTAINER_CGROUPS_DELETE_TIMEOUT =
1303      1000;
1304
1305  /**
1306   * Delay between attempts to remove linux cgroup.
1307   */
1308  public static final String NM_LINUX_CONTAINER_CGROUPS_DELETE_DELAY =
1309      NM_PREFIX + "linux-container-executor.cgroups.delete-delay-ms";
1310
1311  public static final long DEFAULT_NM_LINUX_CONTAINER_CGROUPS_DELETE_DELAY =
1312      20;
1313
1314  /**
1315   * Indicates if memory and CPU limits will be set for the Windows Job
1316   * Object for the containers launched by the default container executor.
1317   */
1318  public static final String NM_WINDOWS_CONTAINER_MEMORY_LIMIT_ENABLED =
1319      NM_PREFIX + "windows-container.memory-limit.enabled";
1320  public static final boolean DEFAULT_NM_WINDOWS_CONTAINER_MEMORY_LIMIT_ENABLED = false;
1321
1322  public static final String NM_WINDOWS_CONTAINER_CPU_LIMIT_ENABLED =
1323      NM_PREFIX + "windows-container.cpu-limit.enabled";
1324  public static final boolean DEFAULT_NM_WINDOWS_CONTAINER_CPU_LIMIT_ENABLED = false;
1325
1326  /** 
1327  /* The Windows group that the windows-secure-container-executor should run as.
1328  */
1329  public static final String NM_WINDOWS_SECURE_CONTAINER_GROUP =
1330      NM_PREFIX + "windows-secure-container-executor.group";
1331
1332  /** T-file compression types used to compress aggregated logs.*/
1333  public static final String NM_LOG_AGG_COMPRESSION_TYPE = 
1334    NM_PREFIX + "log-aggregation.compression-type";
1335  public static final String DEFAULT_NM_LOG_AGG_COMPRESSION_TYPE = "none";
1336  
1337  /** The kerberos principal for the node manager.*/
1338  public static final String NM_PRINCIPAL =
1339    NM_PREFIX + "principal";
1340  
1341  public static final String NM_AUX_SERVICES = 
1342    NM_PREFIX + "aux-services";
1343  
1344  public static final String NM_AUX_SERVICE_FMT =
1345    NM_PREFIX + "aux-services.%s.class";
1346
1347  public static final String NM_USER_HOME_DIR =
1348      NM_PREFIX + "user-home-dir";
1349  
1350  /**The kerberos principal to be used for spnego filter for NM.*/
1351  public static final String NM_WEBAPP_SPNEGO_USER_NAME_KEY =
1352      NM_PREFIX + "webapp.spnego-principal";
1353  
1354  /**The kerberos keytab to be used for spnego filter for NM.*/
1355  public static final String NM_WEBAPP_SPNEGO_KEYTAB_FILE_KEY =
1356      NM_PREFIX + "webapp.spnego-keytab-file";
1357  
1358  public static final String DEFAULT_NM_USER_HOME_DIR= "/home/";
1359
1360  public static final String NM_RECOVERY_PREFIX = NM_PREFIX + "recovery.";
1361  public static final String NM_RECOVERY_ENABLED =
1362      NM_RECOVERY_PREFIX + "enabled";
1363  public static final boolean DEFAULT_NM_RECOVERY_ENABLED = false;
1364
1365  public static final String NM_RECOVERY_DIR = NM_RECOVERY_PREFIX + "dir";
1366
1367  /** The time in seconds between full compactions of the NM state database.
1368   *  Setting the interval to zero disables the full compaction cycles.
1369   */
1370  public static final String NM_RECOVERY_COMPACTION_INTERVAL_SECS =
1371      NM_RECOVERY_PREFIX + "compaction-interval-secs";
1372  public static final int DEFAULT_NM_RECOVERY_COMPACTION_INTERVAL_SECS = 3600;
1373
1374  public static final String NM_RECOVERY_SUPERVISED =
1375      NM_RECOVERY_PREFIX + "supervised";
1376  public static final boolean DEFAULT_NM_RECOVERY_SUPERVISED = false;
1377
1378  public static final String NM_LOG_AGG_POLICY_CLASS =
1379      NM_PREFIX + "log-aggregation.policy.class";
1380
1381  public static final String NM_LOG_AGG_POLICY_CLASS_PARAMETERS = NM_PREFIX
1382      + "log-aggregation.policy.parameters";
1383
1384  ////////////////////////////////
1385  // Web Proxy Configs
1386  ////////////////////////////////
1387  public static final String PROXY_PREFIX = "yarn.web-proxy.";
1388  
1389  /** The kerberos principal for the proxy.*/
1390  public static final String PROXY_PRINCIPAL =
1391    PROXY_PREFIX + "principal";
1392  
1393  /** Keytab for Proxy.*/
1394  public static final String PROXY_KEYTAB = PROXY_PREFIX + "keytab";
1395  
1396  /** The address for the web proxy.*/
1397  public static final String PROXY_ADDRESS =
1398    PROXY_PREFIX + "address";
1399  public static final int DEFAULT_PROXY_PORT = 9099;
1400  public static final String DEFAULT_PROXY_ADDRESS =
1401    "0.0.0.0:" + DEFAULT_PROXY_PORT;
1402  
1403  /**
1404   * YARN Service Level Authorization
1405   */
1406  public static final String 
1407  YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCETRACKER_PROTOCOL =
1408      "security.resourcetracker.protocol.acl";
1409  public static final String 
1410  YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONCLIENT_PROTOCOL =
1411      "security.applicationclient.protocol.acl";
1412  public static final String 
1413  YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCEMANAGER_ADMINISTRATION_PROTOCOL =
1414      "security.resourcemanager-administration.protocol.acl";
1415  public static final String 
1416  YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONMASTER_PROTOCOL =
1417      "security.applicationmaster.protocol.acl";
1418
1419  public static final String 
1420  YARN_SECURITY_SERVICE_AUTHORIZATION_CONTAINER_MANAGEMENT_PROTOCOL =
1421      "security.containermanagement.protocol.acl";
1422  public static final String 
1423  YARN_SECURITY_SERVICE_AUTHORIZATION_RESOURCE_LOCALIZER =
1424      "security.resourcelocalizer.protocol.acl";
1425
1426  public static final String
1427  YARN_SECURITY_SERVICE_AUTHORIZATION_APPLICATIONHISTORY_PROTOCOL =
1428      "security.applicationhistory.protocol.acl";
1429
1430  /** No. of milliseconds to wait between sending a SIGTERM and SIGKILL
1431   * to a running container */
1432  public static final String NM_SLEEP_DELAY_BEFORE_SIGKILL_MS =
1433      NM_PREFIX + "sleep-delay-before-sigkill.ms";
1434  public static final long DEFAULT_NM_SLEEP_DELAY_BEFORE_SIGKILL_MS =
1435      250;
1436
1437  /** Max time to wait for a process to come up when trying to cleanup
1438   * container resources */
1439  public static final String NM_PROCESS_KILL_WAIT_MS =
1440      NM_PREFIX + "process-kill-wait.ms";
1441  public static final long DEFAULT_NM_PROCESS_KILL_WAIT_MS =
1442      2000;
1443
1444  /** Max time to wait to establish a connection to RM */
1445  public static final String RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
1446      RM_PREFIX + "connect.max-wait.ms";
1447  public static final long DEFAULT_RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
1448      15 * 60 * 1000;
1449
1450  /** Time interval between each attempt to connect to RM */
1451  public static final String RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS =
1452      RM_PREFIX + "connect.retry-interval.ms";
1453  public static final long DEFAULT_RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS
1454      = 30 * 1000;
1455
1456  public static final String DISPATCHER_DRAIN_EVENTS_TIMEOUT =
1457      YARN_PREFIX + "dispatcher.drain-events.timeout";
1458
1459  public static final long DEFAULT_DISPATCHER_DRAIN_EVENTS_TIMEOUT = 300000;
1460
1461  /**
1462   * CLASSPATH for YARN applications. A comma-separated list of CLASSPATH
1463   * entries
1464   */
1465  public static final String YARN_APPLICATION_CLASSPATH = YARN_PREFIX
1466      + "application.classpath";
1467
1468  public static final String AMRM_PROXY_ENABLED = NM_PREFIX
1469      + "amrmproxy.enable";
1470  public static final boolean DEFAULT_AMRM_PROXY_ENABLED = false;
1471  public static final String AMRM_PROXY_ADDRESS = NM_PREFIX
1472      + "amrmproxy.address";
1473  public static final int DEFAULT_AMRM_PROXY_PORT = 8048;
1474  public static final String DEFAULT_AMRM_PROXY_ADDRESS = "0.0.0.0:"
1475      + DEFAULT_AMRM_PROXY_PORT;
1476  public static final String AMRM_PROXY_CLIENT_THREAD_COUNT = NM_PREFIX
1477      + "amrmproxy.client.thread-count";
1478  public static final int DEFAULT_AMRM_PROXY_CLIENT_THREAD_COUNT = 25;
1479  public static final String AMRM_PROXY_INTERCEPTOR_CLASS_PIPELINE =
1480      NM_PREFIX + "amrmproxy.interceptor-class.pipeline";
1481  public static final String DEFAULT_AMRM_PROXY_INTERCEPTOR_CLASS_PIPELINE =
1482      "org.apache.hadoop.yarn.server.nodemanager.amrmproxy."
1483          + "DefaultRequestInterceptor";
1484
1485  /**
1486   * Default platform-agnostic CLASSPATH for YARN applications. A
1487   * comma-separated list of CLASSPATH entries. The parameter expansion marker
1488   * will be replaced with real parameter expansion marker ('%' for Windows and
1489   * '$' for Linux) by NodeManager on container launch. For example: {{VAR}}
1490   * will be replaced as $VAR on Linux, and %VAR% on Windows.
1491   */
1492  @Public
1493  @Unstable
1494  public static final String[] DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH= {
1495      ApplicationConstants.Environment.HADOOP_CONF_DIR.$$(),
1496      ApplicationConstants.Environment.HADOOP_COMMON_HOME.$$()
1497          + "/share/hadoop/common/*",
1498      ApplicationConstants.Environment.HADOOP_COMMON_HOME.$$()
1499          + "/share/hadoop/common/lib/*",
1500      ApplicationConstants.Environment.HADOOP_HDFS_HOME.$$()
1501          + "/share/hadoop/hdfs/*",
1502      ApplicationConstants.Environment.HADOOP_HDFS_HOME.$$()
1503          + "/share/hadoop/hdfs/lib/*",
1504      ApplicationConstants.Environment.HADOOP_YARN_HOME.$$()
1505          + "/share/hadoop/yarn/*",
1506      ApplicationConstants.Environment.HADOOP_YARN_HOME.$$()
1507          + "/share/hadoop/yarn/lib/*" };
1508  /**
1509   * <p>
1510   * Default platform-specific CLASSPATH for YARN applications. A
1511   * comma-separated list of CLASSPATH entries constructed based on the client
1512   * OS environment expansion syntax.
1513   * </p>
1514   * <p>
1515   * Note: Use {@link #DEFAULT_YARN_CROSS_PLATFORM_APPLICATION_CLASSPATH} for
1516   * cross-platform practice i.e. submit an application from a Windows client to
1517   * a Linux/Unix server or vice versa.
1518   * </p>
1519   */
1520  public static final String[] DEFAULT_YARN_APPLICATION_CLASSPATH = {
1521      ApplicationConstants.Environment.HADOOP_CONF_DIR.$(),
1522      ApplicationConstants.Environment.HADOOP_COMMON_HOME.$()
1523          + "/share/hadoop/common/*",
1524      ApplicationConstants.Environment.HADOOP_COMMON_HOME.$()
1525          + "/share/hadoop/common/lib/*",
1526      ApplicationConstants.Environment.HADOOP_HDFS_HOME.$()
1527          + "/share/hadoop/hdfs/*",
1528      ApplicationConstants.Environment.HADOOP_HDFS_HOME.$()
1529          + "/share/hadoop/hdfs/lib/*",
1530      ApplicationConstants.Environment.HADOOP_YARN_HOME.$()
1531          + "/share/hadoop/yarn/*",
1532      ApplicationConstants.Environment.HADOOP_YARN_HOME.$()
1533          + "/share/hadoop/yarn/lib/*" };
1534
1535  /** Container temp directory */
1536  public static final String DEFAULT_CONTAINER_TEMP_DIR = "./tmp";
1537
1538  public static final String IS_MINI_YARN_CLUSTER = YARN_PREFIX
1539      + "is.minicluster";
1540
1541  public static final String YARN_MC_PREFIX = YARN_PREFIX + "minicluster.";
1542
1543  /** Whether to use fixed ports with the minicluster. */
1544  public static final String YARN_MINICLUSTER_FIXED_PORTS =
1545      YARN_MC_PREFIX + "fixed.ports";
1546
1547  /**
1548   * Default is false to be able to run tests concurrently without port
1549   * conflicts.
1550   */
1551  public static final boolean DEFAULT_YARN_MINICLUSTER_FIXED_PORTS = false;
1552
1553  /**
1554   * Whether the NM should use RPC to connect to the RM. Default is false.
1555   * Can be set to true only when using fixed ports.
1556   */
1557  public static final String YARN_MINICLUSTER_USE_RPC = YARN_MC_PREFIX + "use-rpc";
1558  public static final boolean DEFAULT_YARN_MINICLUSTER_USE_RPC = false;
1559
1560  /**
1561   * Whether users are explicitly trying to control resource monitoring
1562   * configuration for the MiniYARNCluster. Disabled by default.
1563   */
1564  public static final String YARN_MINICLUSTER_CONTROL_RESOURCE_MONITORING =
1565      YARN_MC_PREFIX + "control-resource-monitoring";
1566  public static final boolean
1567      DEFAULT_YARN_MINICLUSTER_CONTROL_RESOURCE_MONITORING = false;
1568
1569  /** Allow changing the memory for the NodeManager in the MiniYARNCluster */
1570  public static final String YARN_MINICLUSTER_NM_PMEM_MB =
1571      YARN_MC_PREFIX + YarnConfiguration.NM_PMEM_MB;
1572  public static final int DEFAULT_YARN_MINICLUSTER_NM_PMEM_MB = 4 * 1024;
1573
1574  /** The log directory for the containers */
1575  public static final String YARN_APP_CONTAINER_LOG_DIR =
1576      YARN_PREFIX + "app.container.log.dir";
1577
1578  public static final String YARN_APP_CONTAINER_LOG_SIZE =
1579      YARN_PREFIX + "app.container.log.filesize";
1580
1581  public static final String YARN_APP_CONTAINER_LOG_BACKUPS =
1582      YARN_PREFIX + "app.container.log.backups";
1583
1584  ////////////////////////////////
1585  // Timeline Service Configs
1586  ////////////////////////////////
1587
1588  public static final String TIMELINE_SERVICE_PREFIX =
1589      YARN_PREFIX + "timeline-service.";
1590
1591  public static final String TIMELINE_SERVICE_VERSION = TIMELINE_SERVICE_PREFIX
1592      + "version";
1593  public static final float DEFAULT_TIMELINE_SERVICE_VERSION = 1.0f;
1594
1595  /**
1596   * Comma seperated list of names for UIs hosted in the timeline server
1597   * (For pluggable UIs).
1598   */
1599  public static final String TIMELINE_SERVICE_UI_NAMES =
1600      TIMELINE_SERVICE_PREFIX + "ui-names";
1601
1602  /** Relative web path that will serve up this UI (For pluggable UIs). */
1603  public static final String TIMELINE_SERVICE_UI_WEB_PATH_PREFIX =
1604      TIMELINE_SERVICE_PREFIX + "ui-web-path.";
1605
1606  /** Timeline client settings */
1607  public static final String TIMELINE_SERVICE_CLIENT_PREFIX =
1608      TIMELINE_SERVICE_PREFIX + "client.";
1609
1610  /**
1611   * Path to war file or static content directory for this UI
1612   * (For pluggable UIs).
1613   */
1614  public static final String TIMELINE_SERVICE_UI_ON_DISK_PATH_PREFIX =
1615      TIMELINE_SERVICE_PREFIX + "ui-on-disk-path.";
1616
1617  /**
1618   * The setting for timeline service v1.5
1619   */
1620  public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX =
1621      TIMELINE_SERVICE_PREFIX + "entity-group-fs-store.";
1622
1623  public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_ACTIVE_DIR =
1624      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "active-dir";
1625
1626  public static final String
1627      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_ACTIVE_DIR_DEFAULT =
1628      "/tmp/entity-file-history/active";
1629
1630  public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_DONE_DIR =
1631      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "done-dir";
1632  public static final String
1633      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_DONE_DIR_DEFAULT =
1634      "/tmp/entity-file-history/done";
1635
1636  public static final String TIMELINE_SERVICE_ENTITY_GROUP_PLUGIN_CLASSES =
1637      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "group-id-plugin-classes";
1638
1639  public static final String
1640      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SUMMARY_STORE =
1641      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "summary-store";
1642
1643  public static final String
1644      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SUMMARY_ENTITY_TYPES =
1645      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "summary-entity-types";
1646
1647  public static final String
1648      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SCAN_INTERVAL_SECONDS =
1649      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "scan-interval-seconds";
1650  public static final long
1651      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SCAN_INTERVAL_SECONDS_DEFAULT = 60;
1652
1653  public static final String TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_THREADS =
1654      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "threads";
1655  public static final int
1656      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_THREADS_DEFAULT = 16;
1657
1658  public static final String
1659      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_APP_CACHE_SIZE
1660      = TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "app-cache-size";
1661  public static final int
1662      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_APP_CACHE_SIZE_DEFAULT = 10;
1663
1664  public static final String
1665      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_CLEANER_INTERVAL_SECONDS =
1666      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "cleaner-interval-seconds";
1667  public static final int
1668      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_CLEANER_INTERVAL_SECONDS_DEFAULT =
1669        60 * 60;
1670
1671  public static final String
1672      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_RETAIN_SECONDS
1673      = TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "retain-seconds";
1674  public static final int
1675      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_RETAIN_SECONDS_DEFAULT =
1676        7 * 24 * 60 * 60;
1677
1678  // how old the most recent log of an UNKNOWN app needs to be in the active
1679  // directory before we treat it as COMPLETED
1680  public static final String
1681      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_UNKNOWN_ACTIVE_SECONDS =
1682      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "unknown-active-seconds";
1683  public static final int
1684      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_UNKNOWN_ACTIVE_SECONDS_DEFAULT
1685      = 24 * 60 * 60;
1686
1687  public static final String
1688      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_RETRY_POLICY_SPEC =
1689      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX + "retry-policy-spec";
1690  public static final String
1691      DEFAULT_TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_RETRY_POLICY_SPEC =
1692      "2000, 500";
1693
1694  public static final String TIMELINE_SERVICE_LEVELDB_CACHE_READ_CACHE_SIZE =
1695      TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_PREFIX
1696          + "leveldb-cache-read-cache-size";
1697
1698  public static final long
1699      DEFAULT_TIMELINE_SERVICE_LEVELDB_CACHE_READ_CACHE_SIZE = 10 * 1024 * 1024;
1700
1701  public static final String TIMELINE_SERVICE_CLIENT_FD_FLUSH_INTERVAL_SECS =
1702      TIMELINE_SERVICE_CLIENT_PREFIX + "fd-flush-interval-secs";
1703  public static final long
1704      TIMELINE_SERVICE_CLIENT_FD_FLUSH_INTERVAL_SECS_DEFAULT = 10;
1705
1706  public static final String TIMELINE_SERVICE_CLIENT_FD_CLEAN_INTERVAL_SECS =
1707      TIMELINE_SERVICE_CLIENT_PREFIX + "fd-clean-interval-secs";
1708  public static final long
1709      TIMELINE_SERVICE_CLIENT_FD_CLEAN_INTERVAL_SECS_DEFAULT = 60;
1710
1711  public static final String TIMELINE_SERVICE_CLIENT_FD_RETAIN_SECS =
1712      TIMELINE_SERVICE_CLIENT_PREFIX + "fd-retain-secs";
1713  public static final long TIMELINE_SERVICE_CLIENT_FD_RETAIN_SECS_DEFAULT =
1714      5*60;
1715
1716  public static final String
1717      TIMELINE_SERVICE_CLIENT_INTERNAL_TIMERS_TTL_SECS =
1718      TIMELINE_SERVICE_CLIENT_PREFIX + "internal-timers-ttl-secs";
1719  public static final long
1720      TIMELINE_SERVICE_CLIENT_INTERNAL_TIMERS_TTL_SECS_DEFAULT = 7 * 60;
1721
1722  public static final String
1723      TIMELINE_SERVICE_CLIENT_INTERNAL_ATTEMPT_DIR_CACHE_SIZE =
1724      TIMELINE_SERVICE_CLIENT_PREFIX + "internal-attempt-dir-cache-size";
1725  public static final int
1726      DEFAULT_TIMELINE_SERVICE_CLIENT_INTERNAL_ATTEMPT_DIR_CACHE_SIZE = 1000;
1727
1728  // This is temporary solution. The configuration will be deleted once we have
1729  // the FileSystem API to check whether append operation is supported or not.
1730  public static final String TIMELINE_SERVICE_ENTITYFILE_FS_SUPPORT_APPEND
1731      = TIMELINE_SERVICE_PREFIX
1732      + "entity-file.fs-support-append";
1733
1734  // mark app-history related configs @Private as application history is going
1735  // to be integrated into the timeline service
1736  @Private
1737  public static final String APPLICATION_HISTORY_PREFIX =
1738      TIMELINE_SERVICE_PREFIX + "generic-application-history.";
1739
1740  /**
1741   *  The setting that controls whether application history service is
1742   *  enabled or not.
1743   */
1744  @Private
1745  public static final String APPLICATION_HISTORY_ENABLED =
1746      APPLICATION_HISTORY_PREFIX + "enabled";
1747  @Private
1748  public static final boolean DEFAULT_APPLICATION_HISTORY_ENABLED = false;
1749
1750  /** Application history store class */
1751  @Private
1752  public static final String APPLICATION_HISTORY_STORE =
1753      APPLICATION_HISTORY_PREFIX + "store-class";
1754
1755  /** Save container meta-info in the application history store. */
1756  @Private
1757  public static final String
1758      APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO =
1759        APPLICATION_HISTORY_PREFIX + "save-non-am-container-meta-info";
1760  @Private
1761  public static final boolean
1762            DEFAULT_APPLICATION_HISTORY_SAVE_NON_AM_CONTAINER_META_INFO = true;
1763
1764  /** URI for FileSystemApplicationHistoryStore */
1765  @Private
1766  public static final String FS_APPLICATION_HISTORY_STORE_URI =
1767      APPLICATION_HISTORY_PREFIX + "fs-history-store.uri";
1768
1769  /** T-file compression types used to compress history data.*/
1770  @Private
1771  public static final String FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE =
1772      APPLICATION_HISTORY_PREFIX + "fs-history-store.compression-type";
1773  @Private
1774  public static final String
1775      DEFAULT_FS_APPLICATION_HISTORY_STORE_COMPRESSION_TYPE = "none";
1776
1777  /** The setting that controls whether timeline service is enabled or not. */
1778  public static final String TIMELINE_SERVICE_ENABLED =
1779      TIMELINE_SERVICE_PREFIX + "enabled";
1780  public static final boolean DEFAULT_TIMELINE_SERVICE_ENABLED = false;
1781
1782  /** host:port address for timeline service RPC APIs. */
1783  public static final String TIMELINE_SERVICE_ADDRESS =
1784      TIMELINE_SERVICE_PREFIX + "address";
1785  public static final int DEFAULT_TIMELINE_SERVICE_PORT = 10200;
1786  public static final String DEFAULT_TIMELINE_SERVICE_ADDRESS = "0.0.0.0:"
1787      + DEFAULT_TIMELINE_SERVICE_PORT;
1788
1789  /** The listening endpoint for the timeline service application.*/
1790  public static final String TIMELINE_SERVICE_BIND_HOST =
1791      TIMELINE_SERVICE_PREFIX + "bind-host";
1792
1793  /** The number of threads to handle client RPC API requests. */
1794  public static final String TIMELINE_SERVICE_HANDLER_THREAD_COUNT =
1795      TIMELINE_SERVICE_PREFIX + "handler-thread-count";
1796  public static final int DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT = 10;
1797  
1798
1799  /** The address of the timeline service web application.*/
1800  public static final String TIMELINE_SERVICE_WEBAPP_ADDRESS =
1801      TIMELINE_SERVICE_PREFIX  + "webapp.address";
1802
1803  public static final int DEFAULT_TIMELINE_SERVICE_WEBAPP_PORT = 8188;
1804  public static final String DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS =
1805      "0.0.0.0:" + DEFAULT_TIMELINE_SERVICE_WEBAPP_PORT;
1806
1807  /** The https address of the timeline service web application.*/
1808  public static final String TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS =
1809      TIMELINE_SERVICE_PREFIX + "webapp.https.address";
1810
1811  public static final int DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_PORT = 8190;
1812  public static final String DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_ADDRESS =
1813      "0.0.0.0:" + DEFAULT_TIMELINE_SERVICE_WEBAPP_HTTPS_PORT;
1814
1815  /**
1816   * Defines the max number of applications could be fetched using
1817   * REST API or application history protocol and shown in timeline
1818   * server web ui.
1819   */
1820  public static final String APPLICATION_HISTORY_MAX_APPS =
1821      APPLICATION_HISTORY_PREFIX + "max-applications";
1822  public static final long DEFAULT_APPLICATION_HISTORY_MAX_APPS = 10000;
1823
1824  /** Timeline service store class. */
1825  public static final String TIMELINE_SERVICE_STORE =
1826      TIMELINE_SERVICE_PREFIX + "store-class";
1827
1828  /** Timeline service enable data age off */
1829  public static final String TIMELINE_SERVICE_TTL_ENABLE =
1830      TIMELINE_SERVICE_PREFIX + "ttl-enable";
1831
1832  /** Timeline service length of time to retain data */
1833  public static final String TIMELINE_SERVICE_TTL_MS =
1834      TIMELINE_SERVICE_PREFIX + "ttl-ms";
1835
1836  public static final long DEFAULT_TIMELINE_SERVICE_TTL_MS =
1837      1000 * 60 * 60 * 24 * 7;
1838
1839  /** Timeline service rolling period. Valid values are daily, half_daily,
1840   * quarter_daily, and hourly. */
1841  public static final String TIMELINE_SERVICE_ROLLING_PERIOD =
1842      TIMELINE_SERVICE_PREFIX + "rolling-period";
1843
1844  /** Roll a new database each hour. */
1845  public static final String DEFAULT_TIMELINE_SERVICE_ROLLING_PERIOD =
1846      "hourly";
1847
1848  /** Implementation specific configuration prefix for Timeline Service
1849   * leveldb.
1850   */
1851  public static final String TIMELINE_SERVICE_LEVELDB_PREFIX =
1852      TIMELINE_SERVICE_PREFIX + "leveldb-timeline-store.";
1853
1854  /** Timeline service leveldb path */
1855  public static final String TIMELINE_SERVICE_LEVELDB_PATH =
1856      TIMELINE_SERVICE_LEVELDB_PREFIX + "path";
1857
1858  /** Timeline service leveldb read cache (uncompressed blocks). This is
1859   * per rolling instance so should be tuned if using rolling leveldb
1860   * timeline store */
1861  public static final String TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE =
1862      TIMELINE_SERVICE_LEVELDB_PREFIX + "read-cache-size";
1863
1864  /** Default leveldb read cache size if no configuration is specified. */
1865  public static final long DEFAULT_TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE =
1866      100 * 1024 * 1024;
1867
1868  /** Timeline service leveldb write buffer size. */
1869  public static final String TIMELINE_SERVICE_LEVELDB_WRITE_BUFFER_SIZE =
1870      TIMELINE_SERVICE_LEVELDB_PREFIX + "write-buffer-size";
1871
1872  /** Default leveldb write buffer size if no configuration is specified. This
1873   * is per rolling instance so should be tuned if using rolling leveldb
1874   * timeline store. */
1875  public static final int DEFAULT_TIMELINE_SERVICE_LEVELDB_WRITE_BUFFER_SIZE =
1876      16 * 1024 * 1024;
1877
1878  /** Timeline service leveldb write batch size. This value can be tuned down
1879   * to reduce lock time for ttl eviction. */
1880  public static final String
1881      TIMELINE_SERVICE_LEVELDB_WRITE_BATCH_SIZE =
1882      TIMELINE_SERVICE_LEVELDB_PREFIX + "write-batch-size";
1883
1884  /** Default leveldb write batch size is no configuration is specified */
1885  public static final int
1886      DEFAULT_TIMELINE_SERVICE_LEVELDB_WRITE_BATCH_SIZE = 10000;
1887
1888  /** Timeline service leveldb start time read cache (number of entities) */
1889  public static final String
1890      TIMELINE_SERVICE_LEVELDB_START_TIME_READ_CACHE_SIZE =
1891      TIMELINE_SERVICE_LEVELDB_PREFIX + "start-time-read-cache-size";
1892
1893  public static final int
1894      DEFAULT_TIMELINE_SERVICE_LEVELDB_START_TIME_READ_CACHE_SIZE = 10000;
1895
1896  /** Timeline service leveldb start time write cache (number of entities) */
1897  public static final String
1898      TIMELINE_SERVICE_LEVELDB_START_TIME_WRITE_CACHE_SIZE =
1899      TIMELINE_SERVICE_LEVELDB_PREFIX + "start-time-write-cache-size";
1900
1901  public static final int
1902      DEFAULT_TIMELINE_SERVICE_LEVELDB_START_TIME_WRITE_CACHE_SIZE = 10000;
1903
1904  /** Timeline service leveldb interval to wait between deletion rounds */
1905  public static final String TIMELINE_SERVICE_LEVELDB_TTL_INTERVAL_MS =
1906      TIMELINE_SERVICE_LEVELDB_PREFIX + "ttl-interval-ms";
1907
1908  public static final long DEFAULT_TIMELINE_SERVICE_LEVELDB_TTL_INTERVAL_MS =
1909      1000 * 60 * 5;
1910
1911  /** Timeline service leveldb number of concurrent open files. Tuned this
1912   * configuration to stay within system limits. This is per rolling instance
1913   * so should be tuned if using rolling leveldb timeline store. */
1914  public static final String TIMELINE_SERVICE_LEVELDB_MAX_OPEN_FILES =
1915      TIMELINE_SERVICE_LEVELDB_PREFIX + "max-open-files";
1916
1917  /** Default leveldb max open files if no configuration is specified. */
1918  public static final int DEFAULT_TIMELINE_SERVICE_LEVELDB_MAX_OPEN_FILES =
1919      1000;
1920
1921  /** The Kerberos principal for the timeline server.*/
1922  public static final String TIMELINE_SERVICE_PRINCIPAL =
1923      TIMELINE_SERVICE_PREFIX + "principal";
1924
1925  /** The Kerberos keytab for the timeline server.*/
1926  public static final String TIMELINE_SERVICE_KEYTAB =
1927      TIMELINE_SERVICE_PREFIX + "keytab";
1928
1929  /** Enables cross origin support for timeline server.*/
1930  public static final String TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED =
1931      TIMELINE_SERVICE_PREFIX + "http-cross-origin.enabled";
1932
1933  /** Default value for cross origin support for timeline server.*/
1934  public static final boolean
1935      TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED_DEFAULT = false;
1936
1937  /** Timeline client call, max retries (-1 means no limit) */
1938  public static final String TIMELINE_SERVICE_CLIENT_MAX_RETRIES =
1939      TIMELINE_SERVICE_CLIENT_PREFIX + "max-retries";
1940
1941  public static final int DEFAULT_TIMELINE_SERVICE_CLIENT_MAX_RETRIES = 30;
1942
1943  /** Timeline client call, retry interval */
1944  public static final String TIMELINE_SERVICE_CLIENT_RETRY_INTERVAL_MS =
1945      TIMELINE_SERVICE_CLIENT_PREFIX + "retry-interval-ms";
1946
1947  public static final long
1948      DEFAULT_TIMELINE_SERVICE_CLIENT_RETRY_INTERVAL_MS = 1000;
1949
1950  /** Timeline client policy for whether connections are fatal */
1951  public static final String TIMELINE_SERVICE_CLIENT_BEST_EFFORT =
1952      TIMELINE_SERVICE_CLIENT_PREFIX + "best-effort";
1953
1954  public static final boolean
1955      DEFAULT_TIMELINE_SERVICE_CLIENT_BEST_EFFORT = false;
1956
1957  /** Flag to enable recovery of timeline service */
1958  public static final String TIMELINE_SERVICE_RECOVERY_ENABLED =
1959      TIMELINE_SERVICE_PREFIX + "recovery.enabled";
1960  public static final boolean DEFAULT_TIMELINE_SERVICE_RECOVERY_ENABLED = false;
1961
1962  /** Timeline service state store class */
1963  public static final String TIMELINE_SERVICE_STATE_STORE_CLASS =
1964      TIMELINE_SERVICE_PREFIX + "state-store-class";
1965
1966  public static final String TIMELINE_SERVICE_LEVELDB_STATE_STORE_PREFIX =
1967      TIMELINE_SERVICE_PREFIX + "leveldb-state-store.";
1968
1969  /** Timeline service state store leveldb path */
1970  public static final String TIMELINE_SERVICE_LEVELDB_STATE_STORE_PATH =
1971      TIMELINE_SERVICE_LEVELDB_STATE_STORE_PREFIX + "path";
1972
1973  // Timeline delegation token related keys
1974  public static final String  TIMELINE_DELEGATION_KEY_UPDATE_INTERVAL =
1975      TIMELINE_SERVICE_PREFIX + "delegation.key.update-interval";
1976  public static final long    DEFAULT_TIMELINE_DELEGATION_KEY_UPDATE_INTERVAL =
1977      24*60*60*1000; // 1 day
1978  public static final String  TIMELINE_DELEGATION_TOKEN_RENEW_INTERVAL =
1979      TIMELINE_SERVICE_PREFIX + "delegation.token.renew-interval";
1980  public static final long    DEFAULT_TIMELINE_DELEGATION_TOKEN_RENEW_INTERVAL =
1981      24*60*60*1000;  // 1 day
1982  public static final String  TIMELINE_DELEGATION_TOKEN_MAX_LIFETIME =
1983      TIMELINE_SERVICE_PREFIX + "delegation.token.max-lifetime";
1984  public static final long    DEFAULT_TIMELINE_DELEGATION_TOKEN_MAX_LIFETIME =
1985      7*24*60*60*1000; // 7 days
1986
1987  // ///////////////////////////////
1988  // Shared Cache Configs
1989  // ///////////////////////////////
1990  public static final String SHARED_CACHE_PREFIX = "yarn.sharedcache.";
1991
1992  // common configs
1993  /** whether the shared cache is enabled/disabled */
1994  public static final String SHARED_CACHE_ENABLED =
1995      SHARED_CACHE_PREFIX + "enabled";
1996  public static final boolean DEFAULT_SHARED_CACHE_ENABLED = false;
1997
1998  /** The config key for the shared cache root directory. */
1999  public static final String SHARED_CACHE_ROOT =
2000      SHARED_CACHE_PREFIX + "root-dir";
2001  public static final String DEFAULT_SHARED_CACHE_ROOT = "/sharedcache";
2002
2003  /** The config key for the level of nested directories before getting to the
2004   * checksum directory. */
2005  public static final String SHARED_CACHE_NESTED_LEVEL =
2006      SHARED_CACHE_PREFIX + "nested-level";
2007  public static final int DEFAULT_SHARED_CACHE_NESTED_LEVEL = 3;
2008  
2009  // Shared Cache Manager Configs
2010
2011  public static final String SCM_STORE_PREFIX = SHARED_CACHE_PREFIX + "store.";
2012
2013  public static final String SCM_STORE_CLASS = SCM_STORE_PREFIX + "class";
2014  public static final String DEFAULT_SCM_STORE_CLASS =
2015      "org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore";
2016
2017  public static final String SCM_APP_CHECKER_CLASS = SHARED_CACHE_PREFIX
2018      + "app-checker.class";
2019  public static final String DEFAULT_SCM_APP_CHECKER_CLASS =
2020      "org.apache.hadoop.yarn.server.sharedcachemanager.RemoteAppChecker";
2021
2022  /** The address of the SCM admin interface. */
2023  public static final String SCM_ADMIN_ADDRESS =
2024      SHARED_CACHE_PREFIX + "admin.address";
2025  public static final int DEFAULT_SCM_ADMIN_PORT = 8047;
2026  public static final String DEFAULT_SCM_ADMIN_ADDRESS =
2027      "0.0.0.0:" + DEFAULT_SCM_ADMIN_PORT;
2028
2029  /** Number of threads used to handle SCM admin interface. */
2030  public static final String SCM_ADMIN_CLIENT_THREAD_COUNT =
2031      SHARED_CACHE_PREFIX + "admin.thread-count";
2032  public static final int DEFAULT_SCM_ADMIN_CLIENT_THREAD_COUNT = 1;
2033
2034  /** The address of the SCM web application. */
2035  public static final String SCM_WEBAPP_ADDRESS =
2036      SHARED_CACHE_PREFIX + "webapp.address";
2037  public static final int DEFAULT_SCM_WEBAPP_PORT = 8788;
2038  public static final String DEFAULT_SCM_WEBAPP_ADDRESS =
2039      "0.0.0.0:" + DEFAULT_SCM_WEBAPP_PORT;
2040
2041  // In-memory SCM store configuration
2042  
2043  public static final String IN_MEMORY_STORE_PREFIX =
2044      SCM_STORE_PREFIX + "in-memory.";
2045
2046  /**
2047   * A resource in the InMemorySCMStore is considered stale if the time since
2048   * the last reference exceeds the staleness period. This value is specified in
2049   * minutes.
2050   */
2051  public static final String IN_MEMORY_STALENESS_PERIOD_MINS =
2052      IN_MEMORY_STORE_PREFIX + "staleness-period-mins";
2053  public static final int DEFAULT_IN_MEMORY_STALENESS_PERIOD_MINS =
2054      7 * 24 * 60;
2055
2056  /**
2057   * Initial delay before the in-memory store runs its first check to remove
2058   * dead initial applications. Specified in minutes.
2059   */
2060  public static final String IN_MEMORY_INITIAL_DELAY_MINS =
2061      IN_MEMORY_STORE_PREFIX + "initial-delay-mins";
2062  public static final int DEFAULT_IN_MEMORY_INITIAL_DELAY_MINS = 10;
2063  
2064  /**
2065   * The frequency at which the in-memory store checks to remove dead initial
2066   * applications. Specified in minutes.
2067   */
2068  public static final String IN_MEMORY_CHECK_PERIOD_MINS =
2069      IN_MEMORY_STORE_PREFIX + "check-period-mins";
2070  public static final int DEFAULT_IN_MEMORY_CHECK_PERIOD_MINS = 12 * 60;
2071
2072  // SCM Cleaner service configuration
2073
2074  private static final String SCM_CLEANER_PREFIX = SHARED_CACHE_PREFIX
2075      + "cleaner.";
2076
2077  /**
2078   * The frequency at which a cleaner task runs. Specified in minutes.
2079   */
2080  public static final String SCM_CLEANER_PERIOD_MINS =
2081      SCM_CLEANER_PREFIX + "period-mins";
2082  public static final int DEFAULT_SCM_CLEANER_PERIOD_MINS = 24 * 60;
2083
2084  /**
2085   * Initial delay before the first cleaner task is scheduled. Specified in
2086   * minutes.
2087   */
2088  public static final String SCM_CLEANER_INITIAL_DELAY_MINS =
2089      SCM_CLEANER_PREFIX + "initial-delay-mins";
2090  public static final int DEFAULT_SCM_CLEANER_INITIAL_DELAY_MINS = 10;
2091
2092  /**
2093   * The time to sleep between processing each shared cache resource. Specified
2094   * in milliseconds.
2095   */
2096  public static final String SCM_CLEANER_RESOURCE_SLEEP_MS =
2097      SCM_CLEANER_PREFIX + "resource-sleep-ms";
2098  public static final long DEFAULT_SCM_CLEANER_RESOURCE_SLEEP_MS = 0L;
2099
2100  /** The address of the node manager interface in the SCM. */
2101  public static final String SCM_UPLOADER_SERVER_ADDRESS = SHARED_CACHE_PREFIX
2102      + "uploader.server.address";
2103  public static final int DEFAULT_SCM_UPLOADER_SERVER_PORT = 8046;
2104  public static final String DEFAULT_SCM_UPLOADER_SERVER_ADDRESS = "0.0.0.0:"
2105      + DEFAULT_SCM_UPLOADER_SERVER_PORT;
2106
2107  /**
2108   * The number of SCM threads used to handle notify requests from the node
2109   * manager.
2110   */
2111  public static final String SCM_UPLOADER_SERVER_THREAD_COUNT =
2112      SHARED_CACHE_PREFIX + "uploader.server.thread-count";
2113  public static final int DEFAULT_SCM_UPLOADER_SERVER_THREAD_COUNT = 50;
2114
2115  /** The address of the client interface in the SCM. */
2116  public static final String SCM_CLIENT_SERVER_ADDRESS =
2117      SHARED_CACHE_PREFIX + "client-server.address";
2118  public static final int DEFAULT_SCM_CLIENT_SERVER_PORT = 8045;
2119  public static final String DEFAULT_SCM_CLIENT_SERVER_ADDRESS = "0.0.0.0:"
2120      + DEFAULT_SCM_CLIENT_SERVER_PORT;
2121
2122  /** The number of threads used to handle shared cache manager requests. */
2123  public static final String SCM_CLIENT_SERVER_THREAD_COUNT =
2124      SHARED_CACHE_PREFIX + "client-server.thread-count";
2125  public static final int DEFAULT_SCM_CLIENT_SERVER_THREAD_COUNT = 50;
2126
2127  /** the checksum algorithm implementation **/
2128  public static final String SHARED_CACHE_CHECKSUM_ALGO_IMPL =
2129      SHARED_CACHE_PREFIX + "checksum.algo.impl";
2130  public static final String DEFAULT_SHARED_CACHE_CHECKSUM_ALGO_IMPL =
2131      "org.apache.hadoop.yarn.sharedcache.ChecksumSHA256Impl";
2132
2133  // node manager (uploader) configs
2134  /**
2135   * The replication factor for the node manager uploader for the shared cache.
2136   */
2137  public static final String SHARED_CACHE_NM_UPLOADER_REPLICATION_FACTOR =
2138      SHARED_CACHE_PREFIX + "nm.uploader.replication.factor";
2139  public static final int DEFAULT_SHARED_CACHE_NM_UPLOADER_REPLICATION_FACTOR =
2140      10;
2141
2142  public static final String SHARED_CACHE_NM_UPLOADER_THREAD_COUNT =
2143      SHARED_CACHE_PREFIX + "nm.uploader.thread-count";
2144  public static final int DEFAULT_SHARED_CACHE_NM_UPLOADER_THREAD_COUNT = 20;
2145
2146  ////////////////////////////////
2147  // Other Configs
2148  ////////////////////////////////
2149
2150  /**
2151   * Use YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS instead.
2152   * The interval of the yarn client's querying application state after
2153   * application submission. The unit is millisecond.
2154   */
2155  @Deprecated
2156  public static final String YARN_CLIENT_APP_SUBMISSION_POLL_INTERVAL_MS =
2157      YARN_PREFIX + "client.app-submission.poll-interval";
2158
2159  /**
2160   * The interval that the yarn client library uses to poll the completion
2161   * status of the asynchronous API of application client protocol.
2162   */
2163  public static final String YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS =
2164      YARN_PREFIX + "client.application-client-protocol.poll-interval-ms";
2165  public static final long DEFAULT_YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_INTERVAL_MS =
2166      200;
2167
2168  /**
2169   * The duration that the yarn client library waits, cumulatively across polls,
2170   * for an expected state change to occur. Defaults to -1, which indicates no
2171   * limit.
2172   */
2173  public static final String YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_TIMEOUT_MS =
2174      YARN_PREFIX + "client.application-client-protocol.poll-timeout-ms";
2175  public static final long DEFAULT_YARN_CLIENT_APPLICATION_CLIENT_PROTOCOL_POLL_TIMEOUT_MS =
2176      -1;
2177
2178  /**
2179   * Max number of threads in NMClientAsync to process container management
2180   * events
2181   */
2182  public static final String NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE =
2183      YARN_PREFIX + "client.nodemanager-client-async.thread-pool-max-size";
2184  public static final int DEFAULT_NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE = 500;
2185
2186  /**
2187   * Maximum number of proxy connections to cache for node managers. If set
2188   * to a value greater than zero then the cache is enabled and the NMClient
2189   * and MRAppMaster will cache the specified number of node manager proxies.
2190   * There will be at max one proxy per node manager. Ex. configuring it to a
2191   * value of 5 will make sure that client will at max have 5 proxies cached
2192   * with 5 different node managers. These connections for these proxies will
2193   * be timed out if idle for more than the system wide idle timeout period.
2194   * Note that this could cause issues on large clusters as many connections
2195   * could linger simultaneously and lead to a large number of connection
2196   * threads. The token used for authentication will be used only at
2197   * connection creation time. If a new token is received then the earlier
2198   * connection should be closed in order to use the new token. This and
2199   * {@link YarnConfiguration#NM_CLIENT_ASYNC_THREAD_POOL_MAX_SIZE} are related
2200   * and should be in sync (no need for them to be equal).
2201   * If the value of this property is zero then the connection cache is
2202   * disabled and connections will use a zero idle timeout to prevent too
2203   * many connection threads on large clusters.
2204   */
2205  public static final String NM_CLIENT_MAX_NM_PROXIES =
2206      YARN_PREFIX + "client.max-cached-nodemanagers-proxies";
2207  public static final int DEFAULT_NM_CLIENT_MAX_NM_PROXIES = 0;
2208
2209  /** Max time to wait to establish a connection to NM */
2210  public static final String CLIENT_NM_CONNECT_MAX_WAIT_MS =
2211      YARN_PREFIX + "client.nodemanager-connect.max-wait-ms";
2212  public static final long DEFAULT_CLIENT_NM_CONNECT_MAX_WAIT_MS =
2213      3 * 60 * 1000;
2214
2215  /** Time interval between each attempt to connect to NM */
2216  public static final String CLIENT_NM_CONNECT_RETRY_INTERVAL_MS =
2217      YARN_PREFIX + "client.nodemanager-connect.retry-interval-ms";
2218  public static final long DEFAULT_CLIENT_NM_CONNECT_RETRY_INTERVAL_MS
2219      = 10 * 1000;
2220
2221  public static final String YARN_HTTP_POLICY_KEY = YARN_PREFIX + "http.policy";
2222  public static final String YARN_HTTP_POLICY_DEFAULT = HttpConfig.Policy.HTTP_ONLY
2223      .name();
2224
2225  /**
2226   * Max time to wait for NM to connection to RM.
2227   * When not set, proxy will fall back to use value of
2228   * RESOURCEMANAGER_CONNECT_MAX_WAIT_MS.
2229   */
2230  public static final String NM_RESOURCEMANAGER_CONNECT_MAX_WAIT_MS =
2231      YARN_PREFIX + "nodemanager.resourcemanager.connect.max-wait.ms";
2232
2233  /**
2234   * Time interval between each NM attempt to connection to RM.
2235   * When not set, proxy will fall back to use value of
2236   * RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS.
2237   */
2238  public static final String NM_RESOURCEMANAGER_CONNECT_RETRY_INTERVAL_MS =
2239      YARN_PREFIX + "nodemanager.resourcemanager.connect.retry-interval.ms";
2240
2241  /**
2242   * Node-labels configurations
2243   */
2244  public static final String NODE_LABELS_PREFIX = YARN_PREFIX + "node-labels.";
2245  
2246  /** Node label store implementation class */
2247  public static final String FS_NODE_LABELS_STORE_IMPL_CLASS = NODE_LABELS_PREFIX
2248      + "fs-store.impl.class";
2249  public static final String DEFAULT_FS_NODE_LABELS_STORE_IMPL_CLASS =
2250      "org.apache.hadoop.yarn.nodelabels.FileSystemNodeLabelsStore";
2251  
2252  /** URI for NodeLabelManager */
2253  public static final String FS_NODE_LABELS_STORE_ROOT_DIR = NODE_LABELS_PREFIX
2254      + "fs-store.root-dir";
2255  public static final String FS_NODE_LABELS_STORE_RETRY_POLICY_SPEC =
2256      NODE_LABELS_PREFIX + "fs-store.retry-policy-spec";
2257  public static final String DEFAULT_FS_NODE_LABELS_STORE_RETRY_POLICY_SPEC =
2258      "2000, 500";
2259  
2260  /**
2261   * Flag to indicate if the node labels feature enabled, by default it's
2262   * disabled
2263   */
2264  public static final String NODE_LABELS_ENABLED = NODE_LABELS_PREFIX
2265      + "enabled";
2266  public static final boolean DEFAULT_NODE_LABELS_ENABLED = false;
2267  
2268  public static final String NODELABEL_CONFIGURATION_TYPE =
2269      NODE_LABELS_PREFIX + "configuration-type";
2270  
2271  public static final String CENTRALIZED_NODELABEL_CONFIGURATION_TYPE =
2272      "centralized";
2273
2274  public static final String DELEGATED_CENTALIZED_NODELABEL_CONFIGURATION_TYPE =
2275      "delegated-centralized";
2276
2277  public static final String DISTRIBUTED_NODELABEL_CONFIGURATION_TYPE =
2278      "distributed";
2279  
2280  public static final String DEFAULT_NODELABEL_CONFIGURATION_TYPE =
2281      CENTRALIZED_NODELABEL_CONFIGURATION_TYPE;
2282
2283  public static final String MAX_CLUSTER_LEVEL_APPLICATION_PRIORITY =
2284      YARN_PREFIX + "cluster.max-application-priority";
2285
2286  public static final int DEFAULT_CLUSTER_LEVEL_APPLICATION_PRIORITY = 0;
2287
2288  @Private
2289  public static boolean isDistributedNodeLabelConfiguration(Configuration conf) {
2290    return DISTRIBUTED_NODELABEL_CONFIGURATION_TYPE.equals(conf.get(
2291        NODELABEL_CONFIGURATION_TYPE, DEFAULT_NODELABEL_CONFIGURATION_TYPE));
2292  }
2293
2294  @Private
2295  public static boolean isCentralizedNodeLabelConfiguration(
2296      Configuration conf) {
2297    return CENTRALIZED_NODELABEL_CONFIGURATION_TYPE.equals(conf.get(
2298        NODELABEL_CONFIGURATION_TYPE, DEFAULT_NODELABEL_CONFIGURATION_TYPE));
2299  }
2300
2301  @Private
2302  public static boolean isDelegatedCentralizedNodeLabelConfiguration(
2303      Configuration conf) {
2304    return DELEGATED_CENTALIZED_NODELABEL_CONFIGURATION_TYPE.equals(conf.get(
2305        NODELABEL_CONFIGURATION_TYPE, DEFAULT_NODELABEL_CONFIGURATION_TYPE));
2306  }
2307
2308  @Private
2309  public static boolean areNodeLabelsEnabled(
2310      Configuration conf) {
2311    return conf.getBoolean(NODE_LABELS_ENABLED, DEFAULT_NODE_LABELS_ENABLED);
2312  }
2313
2314  private static final String NM_NODE_LABELS_PREFIX = NM_PREFIX
2315      + "node-labels.";
2316
2317  public static final String NM_NODE_LABELS_PROVIDER_CONFIG =
2318      NM_NODE_LABELS_PREFIX + "provider";
2319
2320  // whitelist names for the yarn.nodemanager.node-labels.provider
2321  public static final String CONFIG_NODE_LABELS_PROVIDER = "config";
2322  public static final String SCRIPT_NODE_LABELS_PROVIDER = "script";
2323
2324  private static final String NM_NODE_LABELS_PROVIDER_PREFIX =
2325      NM_NODE_LABELS_PREFIX + "provider.";
2326
2327  public static final String NM_NODE_LABELS_RESYNC_INTERVAL =
2328      NM_NODE_LABELS_PREFIX + "resync-interval-ms";
2329
2330  public static final long DEFAULT_NM_NODE_LABELS_RESYNC_INTERVAL =
2331      2 * 60 * 1000;
2332
2333  // If -1 is configured then no timer task should be created
2334  public static final String NM_NODE_LABELS_PROVIDER_FETCH_INTERVAL_MS =
2335      NM_NODE_LABELS_PROVIDER_PREFIX + "fetch-interval-ms";
2336
2337  public static final String NM_NODE_LABELS_PROVIDER_FETCH_TIMEOUT_MS =
2338      NM_NODE_LABELS_PROVIDER_PREFIX + "fetch-timeout-ms";
2339
2340  // once in 10 mins
2341  public static final long DEFAULT_NM_NODE_LABELS_PROVIDER_FETCH_INTERVAL_MS =
2342      10 * 60 * 1000;
2343
2344  // Twice of default interval time
2345  public static final long DEFAULT_NM_NODE_LABELS_PROVIDER_FETCH_TIMEOUT_MS =
2346      DEFAULT_NM_NODE_LABELS_PROVIDER_FETCH_INTERVAL_MS * 2;
2347
2348  public static final String NM_PROVIDER_CONFIGURED_NODE_PARTITION =
2349      NM_NODE_LABELS_PROVIDER_PREFIX + "configured-node-partition";
2350
2351  private static final String RM_NODE_LABELS_PREFIX = RM_PREFIX
2352      + "node-labels.";
2353
2354  public static final String RM_NODE_LABELS_PROVIDER_CONFIG =
2355      RM_NODE_LABELS_PREFIX + "provider";
2356
2357  private static final String RM_NODE_LABELS_PROVIDER_PREFIX =
2358      RM_NODE_LABELS_PREFIX + "provider.";
2359
2360  //If -1 is configured then no timer task should be created
2361  public static final String RM_NODE_LABELS_PROVIDER_FETCH_INTERVAL_MS =
2362      RM_NODE_LABELS_PROVIDER_PREFIX + "fetch-interval-ms";
2363
2364  //once in 30 mins
2365  public static final long DEFAULT_RM_NODE_LABELS_PROVIDER_FETCH_INTERVAL_MS =
2366      30 * 60 * 1000;
2367
2368  @Private
2369  /**
2370   * This is a private feature that isn't supposed to be used by end-users.
2371   */
2372  public static final String AM_SCHEDULING_NODE_BLACKLISTING_ENABLED =
2373      RM_PREFIX + "am-scheduling.node-blacklisting-enabled";
2374  @Private
2375  public static final boolean DEFAULT_AM_SCHEDULING_NODE_BLACKLISTING_ENABLED =
2376      false;
2377
2378  @Private
2379  /**
2380   * This is a private feature that isn't supposed to be used by end-users.
2381   */
2382  public static final String AM_SCHEDULING_NODE_BLACKLISTING_DISABLE_THRESHOLD =
2383      RM_PREFIX + "am-scheduling.node-blacklisting-disable-threshold";
2384  @Private
2385  public static final float
2386      DEFAULT_AM_SCHEDULING_NODE_BLACKLISTING_DISABLE_THRESHOLD = 0.2f;
2387
2388  private static final String NM_SCRIPT_BASED_NODE_LABELS_PROVIDER_PREFIX =
2389      NM_NODE_LABELS_PROVIDER_PREFIX + "script.";
2390
2391  public static final String NM_SCRIPT_BASED_NODE_LABELS_PROVIDER_PATH =
2392      NM_SCRIPT_BASED_NODE_LABELS_PROVIDER_PREFIX + "path";
2393
2394  public static final String NM_SCRIPT_BASED_NODE_LABELS_PROVIDER_SCRIPT_OPTS =
2395      NM_SCRIPT_BASED_NODE_LABELS_PROVIDER_PREFIX + "opts";
2396
2397  public YarnConfiguration() {
2398    super();
2399  }
2400  
2401  public YarnConfiguration(Configuration conf) {
2402    super(conf);
2403    if (! (conf instanceof YarnConfiguration)) {
2404      this.reloadConfiguration();
2405    }
2406  }
2407
2408  @Private
2409  public static List<String> getServiceAddressConfKeys(Configuration conf) {
2410    return useHttps(conf) ? RM_SERVICES_ADDRESS_CONF_KEYS_HTTPS
2411        : RM_SERVICES_ADDRESS_CONF_KEYS_HTTP;
2412  }
2413
2414  /**
2415   * Get the socket address for <code>name</code> property as a
2416   * <code>InetSocketAddress</code>. On a HA cluster,
2417   * this fetches the address corresponding to the RM identified by
2418   * {@link #RM_HA_ID}.
2419   * @param name property name.
2420   * @param defaultAddress the default value
2421   * @param defaultPort the default port
2422   * @return InetSocketAddress
2423   */
2424  @Override
2425  public InetSocketAddress getSocketAddr(
2426      String name, String defaultAddress, int defaultPort) {
2427    String address;
2428    if (HAUtil.isHAEnabled(this) && getServiceAddressConfKeys(this).contains(name)) {
2429      address = HAUtil.getConfValueForRMInstance(name, defaultAddress, this);
2430    } else {
2431      address = get(name, defaultAddress);
2432    }
2433    return NetUtils.createSocketAddr(address, defaultPort, name);
2434  }
2435
2436  @Override
2437  public InetSocketAddress updateConnectAddr(String name,
2438                                             InetSocketAddress addr) {
2439    String prefix = name;
2440    if (HAUtil.isHAEnabled(this) && getServiceAddressConfKeys(this).contains(name)) {
2441      prefix = HAUtil.addSuffix(prefix, HAUtil.getRMHAId(this));
2442    }
2443    return super.updateConnectAddr(prefix, addr);
2444  }
2445
2446  @Private
2447  public static int getRMDefaultPortNumber(String addressPrefix,
2448      Configuration conf) {
2449    if (addressPrefix.equals(YarnConfiguration.RM_ADDRESS)) {
2450      return YarnConfiguration.DEFAULT_RM_PORT;
2451    } else if (addressPrefix.equals(YarnConfiguration.RM_SCHEDULER_ADDRESS)) {
2452      return YarnConfiguration.DEFAULT_RM_SCHEDULER_PORT;
2453    } else if (addressPrefix.equals(YarnConfiguration.RM_WEBAPP_ADDRESS)) {
2454      return YarnConfiguration.DEFAULT_RM_WEBAPP_PORT;
2455    } else if (addressPrefix.equals(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS)) {
2456      return YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT;
2457    } else if (addressPrefix
2458        .equals(YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS)) {
2459      return YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_PORT;
2460    } else if (addressPrefix.equals(YarnConfiguration.RM_ADMIN_ADDRESS)) {
2461      return YarnConfiguration.DEFAULT_RM_ADMIN_PORT;
2462    } else {
2463      throw new HadoopIllegalArgumentException(
2464          "Invalid RM RPC address Prefix: " + addressPrefix
2465              + ". The valid value should be one of "
2466              + getServiceAddressConfKeys(conf));
2467    }
2468  }
2469
2470  public static boolean useHttps(Configuration conf) {
2471    return HttpConfig.Policy.HTTPS_ONLY == HttpConfig.Policy.fromString(conf
2472        .get(YARN_HTTP_POLICY_KEY,
2473            YARN_HTTP_POLICY_DEFAULT));
2474  }
2475
2476  public static boolean shouldRMFailFast(Configuration conf) {
2477    return conf.getBoolean(YarnConfiguration.RM_FAIL_FAST,
2478        conf.getBoolean(YarnConfiguration.YARN_FAIL_FAST,
2479            YarnConfiguration.DEFAULT_YARN_FAIL_FAST));
2480  }
2481
2482  @Private
2483  public static String getClusterId(Configuration conf) {
2484    String clusterId = conf.get(YarnConfiguration.RM_CLUSTER_ID);
2485    if (clusterId == null) {
2486      throw new HadoopIllegalArgumentException("Configuration doesn't specify " +
2487          YarnConfiguration.RM_CLUSTER_ID);
2488    }
2489    return clusterId;
2490  }
2491
2492  /* For debugging. mp configurations to system output as XML format. */
2493  public static void main(String[] args) throws Exception {
2494    new YarnConfiguration(new Configuration()).writeXml(System.out);
2495  }
2496}