apache/hadoop · error · HadoopIllegalArgumentException

HA is not enabled for this namenode.

Error message

HA is not enabled for this namenode.

What it means

BootstrapStandby.parseConfAndFindOtherNN() refuses to run when HAUtil.isHAEnabled(conf, nsId) is false — the node's configuration does not define an HA nameservice (no dfs.ha.namenodes.<nameservice> listing multiple NameNodes). '-bootstrapStandby' only makes sense for HA, so it aborts with HadoopIllegalArgumentException.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/BootstrapStandby.java:461

    }
  }

  private boolean checkLayoutVersion(NamespaceInfo nsInfo, boolean isRollingUpgrade) {
    if (isRollingUpgrade) {
      // During a rolling upgrade the service layout versions may be different,
      // but we should check that the layout version being sent is compatible
      return nsInfo.getLayoutVersion() <=
          HdfsServerConstants.MINIMUM_COMPATIBLE_NAMENODE_LAYOUT_VERSION;
    }
    return nsInfo.getLayoutVersion() == nsInfo.getServiceLayoutVersion();
  }

  private void parseConfAndFindOtherNN() throws IOException {
    Configuration conf = getConf();
    nsId = DFSUtil.getNamenodeNameServiceId(conf);

    if (!HAUtil.isHAEnabled(conf, nsId)) {
      throw new HadoopIllegalArgumentException(
          "HA is not enabled for this namenode.");
    }
    nnId = HAUtil.getNameNodeId(conf, nsId);
    NameNode.initializeGenericKeys(conf, nsId, nnId);

    if (!HAUtil.usesSharedEditsDir(conf)) {
      throw new HadoopIllegalArgumentException(
        "Shared edits storage is not enabled for this namenode.");
    }


    remoteNNs = RemoteNameNodeInfo.getRemoteNameNodes(conf, nsId);
    // validate the configured NNs
    List<RemoteNameNodeInfo> remove = new ArrayList<RemoteNameNodeInfo>(remoteNNs.size());
    for (RemoteNameNodeInfo info : remoteNNs) {
      InetSocketAddress address = info.getIpcAddress();
      LOG.info("Found nn: " + info.getNameNodeID() + ", ipc: " + info.getIpcAddress());
      if (address.getPort() == 0 || address.getAddress().isAnyLocalAddress()) {

View on GitHub (pinned to 2add963021)

Solutions

  1. Add full HA config on this node: dfs.nameservices, dfs.ha.namenodes.<nsId> with both NN ids, and per-NN rpc/http address keys
  2. Verify the right config files load (hdfs getconf -nameservices; check HADOOP_CONF_DIR) and that the nsId matches the keys
  3. Re-run 'hdfs namenode -bootstrapStandby' once HA config is in place

Example fix

<!-- before: no HA keys -->
<property><name>dfs.namenode.http-address</name><value>nn1:9870</value></property>
<!-- after -->
<property><name>dfs.nameservices</name><value>ns1</value></property>
<property><name>dfs.ha.namenodes.ns1</name><value>nn1,nn2</value></property>
<property><name>dfs.namenode.rpc-address.ns1.nn1</name><value>nn1:8020</value></property>
<property><name>dfs.namenode.rpc-address.ns1.nn2</name><value>nn2:8020</value></property>
Defensive patterns

Strategy: validation

Validate before calling

String nsId = DFSUtil.getNamenodeNameServiceId(conf);
if (!HAUtil.isHAEnabled(conf, nsId)) {
  throw new IOException("Refusing bootstrapStandby: HA not configured for "
      + "nameservice '" + nsId + "' — set dfs.nameservices and "
      + "dfs.ha.namenodes." + nsId);
}

Try / catch

try {
  tool.run(argv); // BootstrapStandby
} catch (HadoopIllegalArgumentException e) { // "HA is not enabled..."
  // config problem: deploy full HA config to this node, then re-run
}

Prevention

When it happens

Trigger: Running 'hdfs namenode -bootstrapStandby' on a node whose hdfs-site.xml has no HA nameservice configuration for its nameservice id (missing dfs.nameservices / dfs.ha.namenodes.<nsId> entries), or the wrong (default) config file is picked up so nsId resolves to nothing.

Common situations: Fresh standby node provisioned from a non-HA template; configuration staged to the wrong directory so the NN starts with an old hdfs-site.xml; nameservice id mismatch between dfs.nameservices and dfs.ha.namenodes keys after a rename.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/d15a07c0906f7e90. Report an issue: GitHub.