apache/hadoop · error · DisallowedDatanodeException
Datanode denied communication with namenode because the host
Error message
Datanode denied communication with namenode because the host is not in the include-list: {nodeReg} What it means
Thrown as DisallowedDatanodeException from DatanodeManager.registerDatanode when hostConfigManager.isIncluded(nodeReg) returns false: the datanode's address is not in the include list, so the NameNode refuses registration entirely. This is the hosts-exclusion enforcement point for the classic include/exclude files (dfs.hosts / dfs.hosts.exclude) or the JsonServiceFile-based host configuration.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java:1214
// Reject registration of unresolved datanode to prevent performance
// impact of repetitive DNS lookups later.
final String message = "hostname cannot be resolved (ip="
+ ip + ", hostname=" + hostname + ")";
LOG.warn("Unresolved datanode registration: " + message);
throw new DisallowedDatanodeException(nodeReg, message);
}
// update node registration with the ip and hostname from rpc request
nodeReg.setIpAddr(ip);
nodeReg.setPeerHostName(hostname);
}
try {
nodeReg.setExportedKeys(blockManager.getBlockKeys());
// Checks if the node is not on the hosts list. If it is not, then
// it will be disallowed from registering.
if (!hostConfigManager.isIncluded(nodeReg)) {
throw new DisallowedDatanodeException(nodeReg);
}
NameNode.stateChangeLog.info("BLOCK* registerDatanode: from "
+ nodeReg + " storage " + nodeReg.getDatanodeUuid());
DatanodeDescriptor nodeS = getDatanode(nodeReg.getDatanodeUuid());
DatanodeDescriptor nodeN = host2DatanodeMap.getDatanodeByXferAddr(
nodeReg.getIpAddr(), nodeReg.getXferPort());
if (nodeN != null && nodeN != nodeS) {
NameNode.LOG.info("BLOCK* registerDatanode: " + nodeN);
// nodeN previously served a different data storage,
// which is not served by anybody anymore.
removeDatanode(nodeN);
// physically remove node from datanodeMap
wipeDatanode(nodeN);
nodeN = null;
}View on GitHub (pinned to 2add963021)
Solutions
- Add the datanode (as it reports itself, typically host:transferPort or IP) to the dfs.hosts include file
- Run `hdfs dfsadmin -refreshNodes` on the NameNode and then restart/re-register the datanode (`hdfs --daemon restart datanode`)
- If the node should be decommissioned, this denial is intended — retire the DN
- Check exact matching: use the same hostname form the DN registers with (verify in DN log 'banner' / nodeReg toString)
Example fix
# before: DN not in include list # NN log: Datanode denied communication with namenode: not in include-list # after: allow the node echo 'dn5.example.com:9866' >> /etc/hadoop/dfs.hosts hdfs dfsadmin -refreshNodes hdfs --daemon restart datanode
Defensive patterns
Strategy: validation
Validate before calling
// Ops pre-check: is the DN in the include list before starting it?
String inc = conf.get("dfs.hosts");
String entry = "dn5.example.com:9866";
boolean included = Files.readAllLines(Paths.get(inc)).stream()
.map(String::trim).filter(s -> !s.isEmpty() && !s.startsWith("#"))
.anyMatch(l -> l.equals(entry) || l.split(":")[0].equals(entry.split(":")[0]));
if (!included) { /* add entry + refreshNodes before starting the DN */ } Prevention
- Update dfs.hosts before adding nodes; run `hdfs dfsadmin -refreshNodes` immediately after
- Use the exact hostname:port form the DN registers with
- Automate include-list updates in node provisioning
- Read the denied nodeReg string in the NN log to see the exact unmatched identity
When it happens
Trigger: Datanode starts and registers while its host is absent from dfs.hosts include file (when include-list enforcement is enabled), or it is present only in dfs.hosts.exclude; after editing host files without `hdfs dfsadmin -refreshNodes`, or when DNS/hostname normalization makes the node not match an entry.
Common situations: First-time cluster bring-up without dfs.hosts configured correctly; adding a new DN without updating the include file; hostname vs IP mismatch in the files; decommission config left over excluding the node.
Related errors
- Unable to create the Decommission monitor from {cls}
- Unresolved topology mapping for host {hostname}
- Datanode denied communication with namenode because hostname
- Can not create a Path from a null string
- Can not create a Path from an empty string
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/5c33e290ae66ec2b.
Report an issue: GitHub.