I. Description
After starting Hadoop, it was found that the HDFS web interface could not be opened and the 50070 could not be opened, so JPS found that a namenode was missing:
Check the log information and find the following errors:
2022-01-03 23:54:10,993 INFO org.apache.hadoop.hdfs.server.namenode.FSImage: Planning to load image: FSImageFile(file=/export/servers/hadoop-3.1.4/hadoopDatas/namenodeDatas/current/fsimage_0000000000000052563, cpktTxId=0000000000000052563) 2022-01-03 23:54:10,999 ERROR org.apache.hadoop.hdfs.server.namenode.FSImage: Failed to load image from FSImageFile(file=/export/servers/hadoop-3.1.4/hadoopDatas/namenodeDatas/current/fsimage_0000000000000052563, cpktTxId=0000000000000052563) java.io.IOException: Premature EOF from inputStream at org.apache.hadoop.io.IOUtils.readFully(IOUtils.java:212) at org.apache.hadoop.hdfs.server.namenode.FSImageFormat$LoaderDelegator.load(FSImageFormat.java:222) at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:962) at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:946) at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImageFile(FSImage.java:807) at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:738) at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:336) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1132) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:747) at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:652) at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:723) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:966) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:939) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1705) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1772) 2022-01-03 23:54:11,015 INFO org.apache.hadoop.hdfs.server.namenode.FSImage: Planning to load image: FSImageFile(file=/export/servers/hadoop-3.1.4/hadoopDatas/namenodeDatas2/current/fsimage_0000000000000052563, cpktTxId=0000000000000052563) 2022-01-03 23:54:11,015 ERROR org.apache.hadoop.hdfs.server.namenode.FSImage: Failed to load image from FSImageFile(file=/export/servers/hadoop-3.1.4/hadoopDatas/namenodeDatas2/current/fsimage_0000000000000052563, cpktTxId=0000000000000052563) java.io.IOException: Premature EOF from inputStream at org.apache.hadoop.io.IOUtils.readFully(IOUtils.java:212) at org.apache.hadoop.hdfs.server.namenode.FSImageFormat$LoaderDelegator.load(FSImageFormat.java:222) at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:962) at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:946) at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImageFile(FSImage.java:807) at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:738) at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:336) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1132) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:747) at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:652) at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:723) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:966) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:939) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1705) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1772) 2022-01-03 23:54:11,021 WARN org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Encountered exception loading fsimage java.io.IOException: Failed to load FSImage file, see error(s) above for more info. at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:752) at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:336) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1132) at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:747) at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:652) at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:723) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:966) at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:939) at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1705) at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1772)
II. Solution
According to the error information, it is found that there is an error in reading the file, followed by the file path name. Here, I make an error in reading two files, and then delete the file with the error in the log (it can be backed up in advance)
I have deleted (.MD5 can not be deleted). After restarting HDFS, you can find that namenode has started
Re-enter the HDFS page