Class CombinedHostsFileWriter

java.lang.Object
org.apache.hadoop.hdfs.util.CombinedHostsFileWriter

@LimitedPrivate("HDFS") @Unstable public final class CombinedHostsFileWriter extends Object
Writer support for JSON-based datanode configuration, an alternative format to the exclude/include files configuration. The JSON file format defines the array of elements where each element in the array describes the properties of a datanode. The properties of a datanode is defined by DatanodeAdminProperties. For example, [ {"hostName": "host1"}, {"hostName": "host2", "port": 50, "upgradeDomain": "ud0"}, {"hostName": "host3", "port": 0, "adminState": "DECOMMISSIONED"} ]
  • Method Details

    • writeFile

      public static void writeFile(String hostsFile, Set<DatanodeAdminProperties> allDNs) throws IOException
      Serialize a set of DatanodeAdminProperties to a json file.
      Parameters:
      hostsFile - the json file name.
      allDNs - the set of DatanodeAdminProperties
      Throws:
      IOException