When running a hadoop program, the following error is reported:
Org. apache. hadoop. dfs. SafeModeException: Cannot delete/user/hadoop/input. Name node is in safe mode
This error should be common (at least I did this when running)
Let's analyze this error and understand it literally:
Name node is in safe mode
It indicates that Hadoop's NameNode is in safe mode.
So what is the Hadoop security mode?
When the Distributed File System is started, there will be security mode at the beginning. When the Distributed File System is in security mode, the content in the file system cannot be modified or deleted, until the Security Mode ends. The security mode is mainly used to check the validity of data blocks on each DataNode when the system starts, and to copy or delete some data blocks as required by the policy. You can also enter security mode through commands during runtime. In practice, when the system starts, an error message indicating that the file cannot be modified in security mode is displayed when you modify or delete the file. You only need to wait for a while.
Now we know that we need to solve this problem. I want to keep Hadoop in safe mode. Can I solve it without waiting?
The answer is yes, as long as you enter the following in the Hadoop directory:
Bin/hadoop dfsadmin-safemode leave
That is to say, disable the Hadoop security mode and solve the problem.