Support Questions

Find answers, ask questions, and share your expertise

Namenode safe mode

avatar
Super Collaborator

During maintenance of Cluster, we put Namenode into Safemode.

How to identify if Namenode is in safemode. I mean is there a command which tells us if Namenode is in safemode. Or what are the characteristics that determine Namenode is under Safe mode

1 ACCEPTED SOLUTION

avatar
Expert Contributor

@Viswa

To check Namenode Safe mode status, Login to Namenode host and issue the below command,

[user@NNhost1 ~]$ hdfs dfsadmin -safemode get 
Safe mode is OFF in NNhost1/10.X.X.X:8020 
Safe mode is OFF in NNhost2/10.X.X.X:8020

If Safe mode is turned ON, please issue the below command to leave from safemode.
[user@NNhost1 ~]$ hdfs dfsadmin -safemode leave

View solution in original post

3 REPLIES 3

avatar
Master Guru

Run hadoop dfsadmin -safemode get

[LAKE] [xxx@lake1 ~]# hadoop dfsadmin -safemode get
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.


Safe mode is OFF in xx.xx.xx.com/1xxxx5:8020
Safe mode is OFF in xx.xx.xx.com/1xxx:8020
[LAKE] [xxx@lake1 ~]#


avatar

As per the documentation:

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0-Win/bk_HDP_Install_Win/content/ref-d4ba8d91...

Safemode: Safemode is a state where no changes can be made to the blocks. HDFS cluster is in safemode state during start up because the cluster needs to validate all the blocks and their locations. Once validated, safemode is then disabled.

The options for safemode command are:

hdfs dfsadmin -safemode [enter | leave | get]

Please see the following commands:

root@mycluster:~# su - hdfs
hdfs@mycluster:~$ hdfs dfsadmin -safemode enter
Safe mode is ON
hdfs@mycluster:~$ hdfs dfsadmin -safemode get
Safe mode is ON
hdfs@mycluster:~$ hdfs dfsadmin -safemode leave
Safe mode is OFF
hdfs@mycluster:~$

avatar
Expert Contributor

@Viswa

To check Namenode Safe mode status, Login to Namenode host and issue the below command,

[user@NNhost1 ~]$ hdfs dfsadmin -safemode get 
Safe mode is OFF in NNhost1/10.X.X.X:8020 
Safe mode is OFF in NNhost2/10.X.X.X:8020

If Safe mode is turned ON, please issue the below command to leave from safemode.
[user@NNhost1 ~]$ hdfs dfsadmin -safemode leave