I wanted to collect and organize my own data from the Internet, but I found that Wu Chao wrote a lot of data, so I directly reprinted it (the image is invalid and I used my own image)
Http://www.superwu.cn/2013/08/23/548/
When running a hadoop cluster, the cluster runs in safety mode. Automatically exits after running for a period of time in safe mode.
So what does the system do in security mode?
When the cluster is started, it enters the security mode first. The system checks the integrity of data blocks in safe mode. Suppose we set the number of replicas (that is, the parameter DFS. replication) is 5, so there should be five copies on datanode. If there are only three copies, the ratio is 3/5 = 0.6. Defines a minimum replica rate in the profile hdfs-default.xml
Our copy rate is 0.6, which is significantly less than 0.999, so the system will automatically copy the copy to other datanode, strive for a minimum copy rate> = 0.999. If the system has eight replicas and more than five replicas, the system also deletes more than three replicas.
What is the impact of security mode on us?
At this time, the client is not allowed to modify any files, including uploading, deleting, renaming, and creating folders. For example, when creating a file, the security mode is determined in the source code.
When we modify a file in safe mode, an error is reported.
Under normal circumstances, the security mode automatically exits after a period of time. You only need to wait a moment. How long will it take? We can view the remaining time of exit in security mode through port 50070.
Although you cannot modify a file, you can browse the directory structure and view the file content.
Can we control whether to enter or exit the security mode?
You can control the entry, exit, and view of security mode in the command line,
Run hadoop FS-safemode get to view the Security Mode status.
Run hadoop FS-safemode enter to enter safe mode.
Run hadoop FS-safemode leave to Exit security mode.
Security mode is a protection mechanism for hadoop clusters. When starting, it is best to wait for the cluster to exit automatically and then perform file operations.
Q & A-What is hadoop doing in security mode?