*`ENTERING_MAINTENANCE` The node is being transitioned to maintenance state.
Host-level settings
-----------
To perform any of datanode admin operations, there are two steps.
* Update host-level configuration files to indicate the desired admin states of targeted datanodes. There are two supported formats for configuration files.
* Hostname-only configuration. Each line includes the hostname/ip address for a datanode. That is the default format.
* JSON-based configuration. The configuration is in JSON format. Each element maps to one datanode and each datanode can have multiple properties. This format is required to put datanodes to maintenance states.
* Run the following command to have namenode reload the host-level configuration files.
`hdfs dfsadmin [-refreshNodes]`
### Hostname-only configuration
This is the default configuration used by the namenode. It only supports node decommission and recommission; it doesn't support admin operations related to maintenance state. Use `dfs.hosts` and `dfs.hosts.exclude` as explained in [hdfs-default.xml](./hdfs-default.xml).
In the following example, `host1` and `host2` need to be in service.
`host3` and `host4` need to be in decommissioned state.
dfs.hosts file
```text
host1
host2
host3
host4
```
dfs.hosts.exclude file
```text
host3
host4
```
### JSON-based configuration
JSON-based format is the new configuration format that supports generic properties on datanodes. Set the following
configurations to enable JSON-based format as explained in [hdfs-default.xml](./hdfs-default.xml).
Here is the list of currently supported properties by HDFS.
| Property | Description |
|:---- |:---- |
|`hostName`| Required. The host name of the datanode. |
|`upgradeDomain`| Optional. The upgrade domain id of the datanode. |
|`adminState`| Optional. The expected admin state. The default value is `NORMAL`; `DECOMMISSIONED` for decommission; `IN_MAINTENANCE` for maintenance state. |
|`port`| Optional. the port number of the datanode |
|`maintenanceExpireTimeInMS`| Optional. The epoch time in milliseconds until which the datanode will remain in maintenance state. The default value is forever. |
In the following example, `host1` and `host2` need to be in service. `host3` needs to be in decommissioned state. `host4` needs to be in maintenance state.
Admin states are part of the namenode's webUI and JMX. As explained in [HDFSCommands.html](./HDFSCommands.html), you can also verify admin states using the following commands.
Use `dfsadmin` to check admin states at the cluster level.
`hdfs dfsadmin -report`
Use `fsck` to check admin states of datanodes storing data at a specific path. For backward compatibility, a special flag is required to return maintenance states.
```text
hdfs fsck <path> // only show decommission state
hdfs fsck <path> -maintenance // include maintenance state