Name node is in safe mode. Not able to leave
In order to forcefully let the namenode leave safemode, following command should be executed:
bin/hadoop dfsadmin -safemode leave
You are getting Unknown command
error for your command as -safemode
isn't a sub-command for hadoop fs
, but it is of hadoop dfsadmin
.
Also after the above command, I would suggest you to once run hadoop fsck
so that any inconsistencies crept in the hdfs might be sorted out.
Update:
Use hdfs
command instead of hadoop
command for newer distributions. The hadoop
command is being deprecated:
hdfs dfsadmin -safemode leave
hadoop dfsadmin
has been deprecated and so is hadoop fs
command, all hdfs related tasks are being moved to a separate command hdfs
.
try this, it will work
sudo -u hdfs hdfs dfsadmin -safemode leave
The Command did not work for me but the following did
hdfs dfsadmin -safemode leave
I used the hdfs
command instead of the hadoop
command.
Check out http://ask.gopivotal.com/hc/en-us/articles/200933026-HDFS-goes-into-readonly-mode-and-errors-out-with-Name-node-is-in-safe-mode- link too
safe mode on means (HDFS is in READ only mode)
safe mode off means (HDFS is in Writeable and readable mode)
In Hadoop 2.6.0
, we can check the status of name node with help of the below commands:
TO CHECK THE name node status
$ hdfs dfsadmin -safemode get
TO ENTER IN SAFE MODE:
$ hdfs dfsadmin -safemode enter
TO LEAVE SAFE mode
~$ hdfs dfsadmin -safemode leave