java.io.Closeable, java.lang.AutoCloseable, org.apache.hadoop.service.Servicepublic class NamenodeHeartbeatService extends PeriodicService
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.
| Constructor | Description |
|---|---|
NamenodeHeartbeatService(ActiveNamenodeResolver resolver,
java.lang.String nsId,
java.lang.String nnId) |
Create a new Namenode status updater.
|
NamenodeHeartbeatService(ActiveNamenodeResolver resolver,
java.lang.String nsId,
java.lang.String nnId,
java.lang.String resolvedHost) |
Create a new Namenode status updater.
|
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.String |
getNamenodeDesc() |
Get the description of the Namenode to monitor.
|
protected NamenodeStatusReport |
getNamenodeStatusReport() |
Get the status report for the Namenode monitored by this heartbeater.
|
void |
periodicInvoke() |
Method that the service will run periodically.
|
protected void |
serviceInit(org.apache.hadoop.conf.Configuration configuration) |
|
protected void |
serviceStop() |
getErrorCount, getIntervalMs, getLastUpdate, getRunCount, serviceStart, setIntervalMs, startPeriodic, stopPeriodicclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStoppublic NamenodeHeartbeatService(ActiveNamenodeResolver resolver, java.lang.String nsId, java.lang.String nnId)
resolver - Namenode resolver service to handle NN registration.nsId - Identifier of the nameservice.nnId - Identifier of the namenode in HA.public NamenodeHeartbeatService(ActiveNamenodeResolver resolver, java.lang.String nsId, java.lang.String nnId, java.lang.String resolvedHost)
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.protected void serviceInit(org.apache.hadoop.conf.Configuration configuration)
throws java.lang.Exception
serviceInit in class org.apache.hadoop.service.AbstractServicejava.lang.Exceptionpublic void periodicInvoke()
PeriodicServiceperiodicInvoke in class PeriodicServiceprotected NamenodeStatusReport getNamenodeStatusReport()
public java.lang.String getNamenodeDesc()
protected void serviceStop()
throws java.lang.Exception
serviceStop in class PeriodicServicejava.lang.ExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.