Reputation:
When I am trying to delete a directory in the HDFS file system, I am getting the following error:
Cannot delete directory. Name node is in safe mode.
How to solve this issue? Please advice.
Upvotes: 11
Views: 14420
Reputation: 183
if you are using hadoop 2.9.0 or higher, use
hdfs dfsadmin -safemode leave
Upvotes: 12
Reputation: 11
In my case the hadoop dfsadmin -safemode leave
canceled safemode but as soon as I tried to delete the old directory, the system returned to safemode.
I deleted all the tmp folders that I could find related to hadoop installations but the old directory did not disappear and it could not be deleted.
Finally I used:
ps aux | grep -i namenode
and discovered that there was a running process that was using parameters from an older Hadoop implementation (different version). I killed the process using kill pid
and finally this action removed the old directory.
Upvotes: 1
Reputation: 811
If you see that error that means the Namenode is in safe mode and it is almost equivalent to read-only mode.
To leave the namenode from the safemode run the below command:
$ hadoop dfsadmin –safemode leave
Upvotes: 12