查看状态
bin/hdfs dfsadmin -safemode get
进入安全模式
[root@master hadoop]# bin/hdfs dfsadmin -safemode enter
19/11/03 05:24:20 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Safe mode is ON
退出安全模式
[root@master hadoop]# bin/hdfs dfsadmin -safemode leave
19/11/03 05:24:30 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Safe mode is OFF
修改配置文件
也可修改安全阀值
修改hdfs-site.xml
设置安全阀值属性,属性值默认为0.999f,如果设为1则不进行安全检查,
大于1将永久的处于安全模式
<property>
<name>dfs.safemode.threshold.pct</name>
<value>0.999f</value>
<description>
Specifies the percentage of blocks that should satisfy
the minimal replication requirement defined by dfs.replication.min.
Values less than or equal to 0 mean not to wait for any particular
percentage of blocks before exiting safemode.
Values greater than 1 will make safe mode permanent.
</description>
</property>