public class HostFileManager
extends org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
These files control which DataNodes the NameNode expects to see in the cluster. Loosely speaking, the include file, if it exists and is not empty, is a list of everything we expect to see. The exclude file is a list of everything we want to ignore if we do see it.
Entries may or may not specify a port. If they don't, we consider them to apply to every DataNode on that host. The code canonicalizes the entries into IP addresses.
The code ignores all entries that the DNS fails to resolve their IP addresses. This is okay because by default the NN rejects the registrations of DNs when it fails to do a forward and reverse lookup. Note that DNS resolutions are only done during the loading time to minimize the latency.
Constructor and Description |
---|
HostFileManager() |
Modifier and Type | Method and Description |
---|---|
org.apache.hadoop.conf.Configuration |
getConf() |
HostSet |
getExcludes()
Return all datanodes that should be in decommissioned state.
|
HostSet |
getIncludes()
Return all the datanodes that are allowed to connect to the namenode.
|
long |
getMaintenanceExpirationTimeInMS(org.apache.hadoop.hdfs.protocol.DatanodeID dn)
Get the maintenance expiration time in milli seconds.
|
String |
getUpgradeDomain(org.apache.hadoop.hdfs.protocol.DatanodeID dn)
Get the upgrade domain of a datanode.
|
boolean |
isExcluded(org.apache.hadoop.hdfs.protocol.DatanodeID dn)
Check if a datanode needs to be decommissioned.
|
boolean |
isIncluded(org.apache.hadoop.hdfs.protocol.DatanodeID dn)
Check if a datanode is allowed to connect the namenode.
|
void |
refresh()
Reload the configuration.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
public void setConf(org.apache.hadoop.conf.Configuration conf)
public org.apache.hadoop.conf.Configuration getConf()
public void refresh() throws IOException
org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
refresh
in class org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
IOException
public HostSet getIncludes()
org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
getIncludes
in class org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
public HostSet getExcludes()
org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
getExcludes
in class org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
public boolean isIncluded(org.apache.hadoop.hdfs.protocol.DatanodeID dn)
org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
isIncluded
in class org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
dn
- the DatanodeID of the datanodepublic boolean isExcluded(org.apache.hadoop.hdfs.protocol.DatanodeID dn)
org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
isExcluded
in class org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
dn
- the DatanodeID of the datanodepublic String getUpgradeDomain(org.apache.hadoop.hdfs.protocol.DatanodeID dn)
org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
getUpgradeDomain
in class org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
dn
- the DatanodeID of the datanodepublic long getMaintenanceExpirationTimeInMS(org.apache.hadoop.hdfs.protocol.DatanodeID dn)
org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
getMaintenanceExpirationTimeInMS
in class org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
dn
- the DatanodeID of the datanodeCopyright © 2008–2020 Apache Software Foundation. All rights reserved.