1.在HDFS配置文件中修改安全模式阀值
在hdfs-site.xml中设置安全阀值属性,属性值默认为0.999f,如果设为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>
因为是在配置文件中进行硬修改,不利于管理员操作和修改,因此不推荐此方式
2. 直接在bash输入指令脱离安全模式(推荐)
在安全模式下输入指令:
hadoop dfsadmin -safemode leave
即可退出安全模式。