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