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