dfsadmin 命令用于管理HDFS集群,这些命令常用于管理员。
1. (Safemode)安全模式
动作 | 命令 |
把集群切换到安全模式 | bin/hdfs dfsadmin -safemode [enter/get/leave] |
数据节点状态列表 | bin/hadoop dfsadmin -report |
添加或删除数据节点 | bin/hadoop dfsadmin -refreshNodes |
打印网络拓扑 | bin/hadoop dfsadmin -printTopology |
官当网站 | http://hadoop.apache.org/docs/r2.8.3/hadoop-project-dist/hadoop-hdfs/HDFSCommands.html#dfsadmin |
[hadoop@master bin]$ ./hdfs dfsadmin -safemode enter #进入安全模式
Safe mode is ON
[hadoop@master bin]$ ./hdfs dfsadmin -safemode get #获取当前状态
Safe mode is ON
[hadoop@master bin]$ ./hdfs dfsadmin -safemode leave #离开safemode状态
Safe mode is OFF
[hadoop@master bin]$
安全模式:
On startup, the NameNode enters a special state called Safemode. Replication of data blocks does not occur when the NameNode is in the Safemode state. The NameNode receives Heartbeat and Blockreport messages from the DataNodes. A Blockreport contains the list of data blocks that a DataNode i