Class HostFileManager
java.lang.Object
org.apache.hadoop.hdfs.server.blockmanagement.HostConfigManager
org.apache.hadoop.hdfs.server.blockmanagement.HostFileManager
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable
This class manages the include and exclude files for HDFS.
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.conf.ConfigurationgetConf()Return all datanodes that should be in decommissioned state.Return all the datanodes that are allowed to connect to the namenode.longgetMaintenanceExpirationTimeInMS(org.apache.hadoop.hdfs.protocol.DatanodeID dn) Get the maintenance expiration time in milli seconds.getUpgradeDomain(org.apache.hadoop.hdfs.protocol.DatanodeID dn) Get the upgrade domain of a datanode.booleanisExcluded(org.apache.hadoop.hdfs.protocol.DatanodeID dn) Check if a datanode needs to be decommissioned.booleanisIncluded(org.apache.hadoop.hdfs.protocol.DatanodeID dn) Check if a datanode is allowed to connect the namenode.voidrefresh()Reload the configuration.voidsetConf(org.apache.hadoop.conf.Configuration conf)
-
Constructor Details
-
HostFileManager
public HostFileManager()
-
-
Method Details
-
setConf
public void setConf(org.apache.hadoop.conf.Configuration conf) -
getConf
public org.apache.hadoop.conf.Configuration getConf() -
refresh
Description copied from class:HostConfigManagerReload the configuration.- Specified by:
refreshin classHostConfigManager- Throws:
IOException
-
getIncludes
Description copied from class:HostConfigManagerReturn all the datanodes that are allowed to connect to the namenode.- Specified by:
getIncludesin classHostConfigManager- Returns:
- Iterable of all datanodes
-
getExcludes
Description copied from class:HostConfigManagerReturn all datanodes that should be in decommissioned state.- Specified by:
getExcludesin classHostConfigManager- Returns:
- Iterable of those datanodes
-
isIncluded
public boolean isIncluded(org.apache.hadoop.hdfs.protocol.DatanodeID dn) Description copied from class:HostConfigManagerCheck if a datanode is allowed to connect the namenode.- Specified by:
isIncludedin classHostConfigManager- Parameters:
dn- the DatanodeID of the datanode- Returns:
- boolean if dn is allowed to connect the namenode.
-
isExcluded
public boolean isExcluded(org.apache.hadoop.hdfs.protocol.DatanodeID dn) Description copied from class:HostConfigManagerCheck if a datanode needs to be decommissioned.- Specified by:
isExcludedin classHostConfigManager- Parameters:
dn- the DatanodeID of the datanode- Returns:
- boolean if dn needs to be decommissioned.
-
getUpgradeDomain
Description copied from class:HostConfigManagerGet the upgrade domain of a datanode.- Specified by:
getUpgradeDomainin classHostConfigManager- Parameters:
dn- the DatanodeID of the datanode- Returns:
- the upgrade domain of dn.
-
getMaintenanceExpirationTimeInMS
public long getMaintenanceExpirationTimeInMS(org.apache.hadoop.hdfs.protocol.DatanodeID dn) Description copied from class:HostConfigManagerGet the maintenance expiration time in milli seconds.- Specified by:
getMaintenanceExpirationTimeInMSin classHostConfigManager- Parameters:
dn- the DatanodeID of the datanode- Returns:
- the maintenance expiration time of dn.
-