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