Class ResourceManager
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.service.CompositeService
org.apache.hadoop.yarn.server.resourcemanager.ResourceManager
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service,Recoverable,ResourceManagerMXBean
public class ResourceManager
extends org.apache.hadoop.service.CompositeService
implements Recoverable, ResourceManagerMXBean
The ResourceManager is the main class that is a set of components.
"I am the ResourceManager. All your resources belong to us..."
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classclassRMActiveServices handles all the Active services in the RM.Nested classes/interfaces inherited from class org.apache.hadoop.service.CompositeService
org.apache.hadoop.service.CompositeService.CompositeServiceShutdownHookNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResourceManager.RMActiveServices"Active" services.protected AdminServiceprotected org.apache.hadoop.yarn.server.security.ApplicationACLsManagerstatic final intUsed for generation of various ids.protected ApplicationMasterServiceprotected NMLivelinessMonitorprotected NodesListManagerprotected QueueACLsManagerprotected ReservationSystemprotected ResourceTrackerServiceprotected RMAppManagerprotected RMContextImpl"Always On" services.protected RMSecretManagerServiceprotected ResourceSchedulerstatic final Stringstatic final intPriority of the ResourceManager shutdown hook.static final Stringprotected StringFields inherited from class org.apache.hadoop.service.CompositeService
STOP_ONLY_STARTED_SERVICES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected AdminServiceprotected AllocationTagsManagerprotected ApplicationMasterLauncherprotected AMLivelinessMonitorprotected voidcreateAndInitActiveServices(boolean fromActive) Helper method to create and initactiveServices.org.apache.hadoop.util.curator.ZKCuratorManagercreateAndStartZKManager(org.apache.hadoop.conf.Configuration config) Get ZooKeeper Curator manager, creating and starting if not exists.protected ApplicationMasterServiceprotected ClientRMServiceprotected DelegationTokenRenewerprotected org.apache.hadoop.yarn.event.Dispatcherprotected EmbeddedElectorprotected MultiNodeSortingManager<SchedulerNode>protected org.apache.hadoop.yarn.nodelabels.NodeAttributesManagerprotected RMNodeLabelsManagerprotected PlacementConstraintManagerServiceprotected QueueACLsManagercreateQueueACLsManager(ResourceScheduler scheduler, org.apache.hadoop.conf.Configuration conf) protected ReservationSystemprotected ResourceProfilesManagerprotected ResourceTrackerServiceprotected RMApplicationHistoryWriterprotected RMAppLifetimeMonitorprotected RMAppManagerprotected RMDelegatedNodeLabelsUpdaterCreate RMDelegatedNodeLabelsUpdater based on configuration.protected RMSecretManagerServiceprotected ResourceSchedulerprotected org.apache.hadoop.yarn.event.EventHandler<SchedulerEvent>protected org.apache.hadoop.yarn.server.service.SystemServiceManagerprotected SystemMetricsPublisherprotected voidorg.apache.hadoop.yarn.server.security.ApplicationACLsManagerstatic InetSocketAddressgetBindAddress(org.apache.hadoop.conf.Configuration conf) Retrieve RM bind address from configuration.static longorg.apache.curator.framework.CuratorFrameworkreturn the scheduler.return the resource tracking component.org.apache.hadoop.util.curator.ZKCuratorManagerstatic org.apache.hadoop.http.HttpServer2.BuilderhttpServerTemplateForRM(org.apache.hadoop.conf.Configuration conf, InetSocketAddress httpAddr, InetSocketAddress httpsAddr, String name) Return a HttpServer.Builder that the journalnode / namenode / secondary namenode can use to initialize their HTTP / HTTPS server.booleanGets if security is enabled.static voidvoidrecover(RMStateStore.RMState state) protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidprotected static voidsetClusterTimeStamp(long timestamp) protected voidsetRMStateStore(RMStateStore rmStore) protected voidprotected static voidvalidateConfigs(org.apache.hadoop.conf.Configuration conf) Methods inherited from class org.apache.hadoop.service.CompositeService
addIfService, addService, getServices, removeServiceMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
SHUTDOWN_HOOK_PRIORITY
public static final int SHUTDOWN_HOOK_PRIORITYPriority of the ResourceManager shutdown hook.- See Also:
-
EPOCH_BIT_SHIFT
public static final int EPOCH_BIT_SHIFTUsed for generation of various ids.- See Also:
-
UI2_WEBAPP_NAME
- See Also:
-
SCHEDULER_UI_WEBAPP_NAME
- See Also:
-
rmContext
"Always On" services. Services that need to run always irrespective of the HA state of the RM. -
adminService
-
activeServices
"Active" services. Services that need to run only on the Active RM. These services are managed (initialized, started, stopped) by theCompositeServiceRMActiveServices. RM is active when (1) HA is disabled, or (2) HA is enabled and the RM is in Active state. -
rmSecretManagerService
-
scheduler
-
reservationSystem
-
masterService
-
nmLivelinessMonitor
-
nodesListManager
-
rmAppManager
-
applicationACLsManager
protected org.apache.hadoop.yarn.server.security.ApplicationACLsManager applicationACLsManager -
queueACLsManager
-
resourceTracker
-
webAppAddress
-
-
Constructor Details
-
ResourceManager
public ResourceManager()
-
-
Method Details
-
getRMContext
-
getClusterTimeStamp
public static long getClusterTimeStamp() -
getRMLoginUser
-
setClusterTimeStamp
@VisibleForTesting protected static void setClusterTimeStamp(long timestamp) -
createResourceProfileManager
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
createEmbeddedElector
- Throws:
IOException
-
createAndStartZKManager
public org.apache.hadoop.util.curator.ZKCuratorManager createAndStartZKManager(org.apache.hadoop.conf.Configuration config) throws IOException Get ZooKeeper Curator manager, creating and starting if not exists.- Parameters:
config- Configuration for the ZooKeeper curator.- Returns:
- ZooKeeper Curator manager.
- Throws:
IOException- If it cannot create the manager.
-
getZKManager
public org.apache.hadoop.util.curator.ZKCuratorManager getZKManager() -
getCurator
public org.apache.curator.framework.CuratorFramework getCurator() -
getZkRootNodePassword
-
createQueueACLsManager
protected QueueACLsManager createQueueACLsManager(ResourceScheduler scheduler, org.apache.hadoop.conf.Configuration conf) -
setRMStateStore
-
createSchedulerEventDispatcher
protected org.apache.hadoop.yarn.event.EventHandler<SchedulerEvent> createSchedulerEventDispatcher() -
createDispatcher
protected org.apache.hadoop.yarn.event.Dispatcher createDispatcher() -
createScheduler
-
createReservationSystem
-
createServiceManager
protected org.apache.hadoop.yarn.server.service.SystemServiceManager createServiceManager() -
createAMLauncher
-
createAMLivelinessMonitor
-
createNodeLabelManager
protected RMNodeLabelsManager createNodeLabelManager() throws InstantiationException, IllegalAccessException -
createNodeAttributesManager
protected org.apache.hadoop.yarn.nodelabels.NodeAttributesManager createNodeAttributesManager() -
createAllocationTagsManager
-
createPlacementConstraintManager
-
createDelegationTokenRenewer
-
createRMAppManager
-
createRMApplicationHistoryWriter
-
createMultiNodeSortingManager
-
createSystemMetricsPublisher
-
validateConfigs
protected static void validateConfigs(org.apache.hadoop.conf.Configuration conf) -
httpServerTemplateForRM
public static org.apache.hadoop.http.HttpServer2.Builder httpServerTemplateForRM(org.apache.hadoop.conf.Configuration conf, InetSocketAddress httpAddr, InetSocketAddress httpsAddr, String name) throws IOException Return a HttpServer.Builder that the journalnode / namenode / secondary namenode can use to initialize their HTTP / HTTPS server.- Parameters:
conf- configuration objecthttpAddr- HTTP addresshttpsAddr- HTTPS addressname- Name of the server- Returns:
- builder object
- Throws:
IOException- from Builder
-
startWepApp
protected void startWepApp() -
createAndInitActiveServices
protected void createAndInitActiveServices(boolean fromActive) Helper method to create and initactiveServices. This creates an instance ofResourceManager.RMActiveServicesand initializes it.- Parameters:
fromActive- Indicates if the call is from the active state transition or the RM initialization.
-
areActiveServicesRunning
@VisibleForTesting protected boolean areActiveServicesRunning() -
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
doSecureLogin
- Throws:
IOException
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.CompositeService- Throws:
Exception
-
createResourceTrackerService
-
createClientRMService
-
createApplicationMasterService
-
createAdminService
-
createRMSecretManagerService
-
createRMDelegatedNodeLabelsUpdater
Create RMDelegatedNodeLabelsUpdater based on configuration.- Returns:
- RMDelegatedNodeLabelsUpdater.
-
getClientRMService
-
getResourceScheduler
return the scheduler.- Returns:
- the scheduler for the Resource Manager.
-
getResourceTrackerService
return the resource tracking component.- Returns:
- the resource tracking component.
-
getApplicationMasterService
-
getApplicationACLsManager
@Private public org.apache.hadoop.yarn.server.security.ApplicationACLsManager getApplicationACLsManager() -
getQueueACLsManager
-
getFederationStateStoreService
-
recover
- Specified by:
recoverin interfaceRecoverable- Throws:
Exception
-
main
-
getBindAddress
Retrieve RM bind address from configuration.- Parameters:
conf- Configuration.- Returns:
- InetSocketAddress
-
createRMAppLifetimeMonitor
-
isSecurityEnabled
public boolean isSecurityEnabled()Description copied from interface:ResourceManagerMXBeanGets if security is enabled.- Specified by:
isSecurityEnabledin interfaceResourceManagerMXBean- Returns:
- true, if security is enabled.
-