apache/hadoop · error · ServiceFailedException
HA for namenode is not enabled
Error message
HA for namenode is not enabled
What it means
NameNode.transitionToActive throws ServiceFailedException 'HA for namenode is not enabled' when haEnabled is false - the NameNode was not configured with a nameservice containing multiple NameNodes. State-transition RPCs only exist for HA deployments; a non-HA NameNode is either simply running or not.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java:2015
// log a warning if it take >= 5 seconds.
LOG.warn("Remote IP {} checking available resources took {}ms",
Server.getRemoteIp(), end - start);
}
if (!getNamesystem().nameNodeHasResourcesAvailable()) {
throw new HealthCheckFailedException(
"The NameNode has no resources available");
}
if (notBecomeActiveInSafemode && isInSafeMode()) {
throw new HealthCheckFailedException("The NameNode is configured to " +
"report UNHEALTHY to ZKFC in Safemode.");
}
}
synchronized void transitionToActive() throws IOException {
String operationName = "transitionToActive";
namesystem.checkSuperuserPrivilege(operationName);
if (!haEnabled) {
throw new ServiceFailedException("HA for namenode is not enabled");
}
if (state == OBSERVER_STATE) {
throw new ServiceFailedException(
"Cannot transition from '" + OBSERVER_STATE + "' to '" +
ACTIVE_STATE + "'");
}
if (notBecomeActiveInSafemode && isInSafeMode()) {
throw new ServiceFailedException(getRole() + " still not leave safemode");
}
state.setState(haContext, ACTIVE_STATE);
}
synchronized void transitionToStandby() throws IOException {
String operationName = "transitionToStandby";
namesystem.checkSuperuserPrivilege(operationName);
if (!haEnabled) {
throw new ServiceFailedException("HA for namenode is not enabled");
}View on GitHub (pinned to 2add963021)
Solutions
- On a non-HA cluster, do not call HA admin transitions - the running NameNode already serves as active.
- If HA is actually required, configure it: dfs.nameservices, dfs.ha.namenodes.<nameservice>, shared edits (QJM: dfs.namenode.shared.edits.dir), and fencing, then restart.
- Verify with 'hdfs getconf -confKey dfs.nameservices' - empty output means HA is not configured for this NN.
Example fix
# before hdfs haadmin -transitionToActive nn1 # non-HA cluster -> ServiceFailedException # after # non-HA: the single NameNode is already active - no transition exists # or add real HA config (dfs.nameservices + dfs.ha.namenodes.<id> + QJM) and retry
Defensive patterns
Strategy: validation
Validate before calling
// only issue state transitions on real HA deployments
String nameservice = conf.get("dfs.nameservices");
if (nameservice == null || conf.get("dfs.ha.namenodes." + nameservice) == null)
throw new IllegalStateException("not an HA deployment - skip transitionToActive"); Type guard
boolean isHaNotEnabled(Throwable t) {
return t instanceof org.apache.hadoop.ha.ServiceFailedException
&& "HA for namenode is not enabled".equals(t.getMessage());
} Prevention
- Gate haadmin usage on 'hdfs getconf -confKey dfs.nameservices' being non-empty.
- Maintain separate runbooks for HA vs non-HA clusters instead of one shared script.
- Monitoring dashboards should branch on HA presence before showing transition controls.
When it happens
Trigger: Calling 'hdfs haadmin -transitionToActive <nnId>' (or the HAServiceProtocol transitionToActive RPC) against a NameNode started without dfs.nameservices/dfs.ha.namenodes.<id> HA configuration.
Common situations: Test or single-node clusters where HA admin commands are run out of habit; after removing HA config but keeping operational scripts that call haadmin; misconfigured auto-failover pointing at a non-HA NN.
Related errors
- Configuration has multiple addresses that match local node's
- Configuration dfs.namenode.rpc-address must be suffixed with
- Multiple shared edits directories are not yet supported
- The option dfs.namenode.support.allow.format is set to false
- Cannot transition from 'observer' to 'active'
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/b135d978bc29938c.
Report an issue: GitHub.