Todo: There is something unclear.
1. Configure the namenode checkpoint for ease of demonstration. For more information, see How often namenode checkpoints occur.
2. Start hadoop to ensure that all nodes are normal.
3. Delete all content in the DFS. Name. dir specified directory (that is, the name directory) on the namenode node to simulate a fault.
4. Disable hadoop and check JPs. The namenode is not started successfully.
View the namenode logs in the $ hadooop_home/logs/directory of the namenode node and find the exception: Java. Io. ioexception: namenode is not formated.
At the same time, check the Directory and file status on HDFS. If LS is used, an error is reported.
5. Disable hadoop and format namenode again.
6. Enter the namenode NodeUpperDFS. Name. dir specifies the directory (that is, the name directory), and a new content has been generated. Edit the version in current. Change the namespaceid value to the namespaceid (the original value) in any datanode in the cluster)
7. Delete the newly generated fsimage
8. Copy the fsimage of secondarynamenode.
Note: I copied the files in the namesecondary/image/directory. Some information on the internet says yesNamesecondary/But there is no content in my current.
9. Start hadoop
10. After the instance is started, everything is normal.