解决HDFS突然无法启动

原文链接: https://my.oschina.net/dreamness/blog/3083130

启动HDFS时, 突然NameNode无法启动。
日志上抛出如下异常:

Failed to load image from FSImageFile(file=/dfs/nn/current/fsimage_0000000000000020745, cpktTxId=0000000000000020745)
java.io.IOException: Premature EOF from inputStream
	at org.apache.hadoop.io.IOUtils.readFully(IOUtils.java:203)
	at org.apache.hadoop.hdfs.server.namenode.FSImageFormat$LoaderDelegator.load(FSImageFormat.java:221)
	at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:949)
	at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImage(FSImage.java:933)
	at org.apache.hadoop.hdfs.server.namenode.FSImage.loadFSImageFile(FSImage.java:806)

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:750)
	at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:324)
	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1152)
	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:799)

Failed to start namenode.
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:750)
	at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:324)
	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1152)
	at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:799)

解决方法: 删除日志中读取错误的文件(可以先备份)。

转载于:https://my.oschina.net/dreamness/blog/3083130

你可能感兴趣的:(解决HDFS突然无法启动)