Class NamenodeHeartbeatService
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.hdfs.server.federation.router.PeriodicService
org.apache.hadoop.hdfs.server.federation.router.NamenodeHeartbeatService
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
The
Router periodically checks the state of a Namenode (usually on
the same server) and reports their high availability (HA) state and
load/space status to the
StateStoreService
. Note that this is an optional role as a Router can be independent of any
subcluster.
For performance with Namenode HA, the Router uses the high availability state information in the State Store to forward the request to the Namenode that is most likely to be active.
Note that this service can be embedded into the Namenode itself to simplify the operation.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Constructor Summary
ConstructorsConstructorDescriptionNamenodeHeartbeatService(ActiveNamenodeResolver resolver, String nsId, String nnId) Create a new Namenode status updater.NamenodeHeartbeatService(ActiveNamenodeResolver resolver, String nsId, String nnId, String resolvedHost) Create a new Namenode status updater. -
Method Summary
Modifier and TypeMethodDescriptionGet the description of the Namenode to monitor.protected NamenodeStatusReportGet the status report for the Namenode monitored by this heartbeater.voidMethod that the service will run periodically.protected voidserviceInit(org.apache.hadoop.conf.Configuration configuration) protected voidMethods inherited from class org.apache.hadoop.hdfs.server.federation.router.PeriodicService
getErrorCount, getIntervalMs, getLastUpdate, getRunCount, serviceStart, setIntervalMs, startPeriodic, stopPeriodicMethods 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
-
Constructor Details
-
NamenodeHeartbeatService
Create a new Namenode status updater.- Parameters:
resolver- Namenode resolver service to handle NN registration.nsId- Identifier of the nameservice.nnId- Identifier of the namenode in HA.
-
NamenodeHeartbeatService
public NamenodeHeartbeatService(ActiveNamenodeResolver resolver, String nsId, String nnId, String resolvedHost) Create a new Namenode status updater.- Parameters:
resolver- Namenode resolver service to handle NN registration.nsId- Identifier of the nameservice.nnId- Identifier of the namenode in HA.resolvedHost- resolvedHostname for this specific namenode.
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
periodicInvoke
public void periodicInvoke()Description copied from class:PeriodicServiceMethod that the service will run periodically.- Specified by:
periodicInvokein classPeriodicService
-
getNamenodeStatusReport
Get the status report for the Namenode monitored by this heartbeater.- Returns:
- Namenode status report.
-
getNamenodeDesc
Get the description of the Namenode to monitor.- Returns:
- Description of the Namenode to monitor.
-
serviceStop
- Overrides:
serviceStopin classPeriodicService- Throws:
Exception
-