Solved command:
bin/hadoop dfsadmin -safemode leave #关闭safe mode
With safe mode learning:
safemode
The NameNode first enters the safe mode when it is started. If the lost block of the datanode reaches a certain proportion (1-dfs.safemode.threshold.pct), the system will always be in the safe mode state, that is, read-only state.
dfs.safemode.threshold.pct (default value 0.999f) indicates that when HDFS starts, if the number of blocks reported by the DataNode reaches 0.999 times the number of blocks recorded in the metadata, the safe mode can be left, otherwise it will always be like this Read-only mode. If set to 1, HDFS is always in SafeMode.
The following line is excerpted from the log when the NameNode starts (block reporting ratio 1 reaches the threshold of 0.9990)
The ratio of reported blocks 1.0000 has reached the threshold 0.9990. Safe mode will be turned off automatically in 18 seconds.
hadoop dfsadmin -safemode leave
There are two ways to leave this safe mode
1. Modify dfs.safemode.threshold.pct to a relatively small value, the default is 0.999.
2. hadoop dfsadmin -safemode leave command to force leave
-----------------------------
Safe mode is exited when the minimal replication condition is reached, plus an extension
time of 30 seconds. The minimal replication condition is when 99.9% of the blocks in
the whole filesystem meet their minimum replication level (which defaults to one, and
is set by dfs.replication.min).
Prerequisite for safe mode exit - 99.9% (default is 99.9%, can be set by dfs.safemode.threshold.pct) Blocks in the entire file system reach the minimum backup level (default is 1, can be set by dfs.replication.min) .
dfs.safemode.threshold.pct float 0.999
The proportion of blocks in the system that must meet the minimum
replication level defined by dfs.rep lication.min before the namenode
will exit safe mode. Setting
this value to 0 or less forces the name-node not to start in safe mode.
Setting this value to more than 1 means the namenode never exits safe
mode.
-----------------------------
Users can operate the safe mode through dfsadmin -safemode value. The description of the parameter value is as follows:
enter - enter safe mode
leave - Force the NameNode to leave safe mode
get - returns information about whether safe mode is enabled
wait - wait until safe mode ends.