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