人工智能学习

解决HDFS无法启动namenode,报错Premature EOF from inputStream;Failed to load FSImage file, see error(s) above

本文主要是介绍解决HDFS无法启动namenode,报错Premature EOF from inputStream;Failed to load FSImage file, see error(s) above,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

一.情况描述

启动hadoop后发现无法打开hdfs web界面,50070打不开,于是jps发现少了一个namenode:

 查看日志信息,发现如下报错:

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)

二.解决方案

根据报错信息,发现是读取文件错误,后面即是文件路径名称,我这里是读取两个文件出错,然后删除日志中读取错误的文件(可以提前备份)

我这里已经删除了(.md5可以不删),之后重启hdfs,可以发现namenode已启动

 重新进入hdfs页面

 

这篇关于解决HDFS无法启动namenode,报错Premature EOF from inputStream;Failed to load FSImage file, see error(s) above的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!