When Hadoop NameNode enter in the Safemode ?
The Namenode enters Safemode in primarily two cases:
During the startup of namenode daemon, the namenode enters safe mode for a certain period of time.
The administrator can also enter the Safemode manually with the below command (in the case of maintenance/up-gradation of the cluster ):
hadoop dfsadmin -safemode enter
What is the need of Safemode ?/ why namenode enters into the Safemode?
The primary reason of namenode to enter Safemode is to ensure that the minimum replication condition is reached. The minimum replication condition is when 99.9% of the blocks in the whole HDFS meet their minimum replication factor/level (which is by default 1, and can be configured by dfs.replication.min)
This ensures High Availability, reliability, Fault Tolerance of data before any data manipulation in file system takes place.