无法使用“ HDFS NameNode ImportCheckpoint”导入新的fsimage

时间:2019-02-26 07:32:44

标签: hadoop hdfs namenode

我有一个名称节点,其fsimage损坏了,并且只有一个fsimage可用。我有secondarynamenode具有可用的检查点。 现在,我想将Checkpoint导入一个新目录。 旧目录:cd /home/rakeshbharadwaj/Desktop/hadoop-2.7.4-ex2/nn 新目录:我已在hdfs-site.xml中将其更改为/home/rakeshbharadwaj/Desktop/hadoop-2.7.4-ex2/new

我尝试运行hdfs namenode importcheckPoint,它给了我以下错误

19/02/26 12:38:51 INFO common.Storage: Lock on /home/rakeshbharadwaj/Desktop/hadoop-2.7.4-ex2/new/in_use.lock acquired by nodename 5270@rakeshbharadwaj-VirtualBox
19/02/26 12:38:51 INFO namenode.FSImage: Storage directory /home/rakeshbharadwaj/Desktop/hadoop-2.7.4-ex2/new is not formatted.
19/02/26 12:38:51 INFO namenode.FSImage: Formatting ...
19/02/26 12:38:51 INFO common.Storage: Lock on /tmp/hadoop-rakeshbharadwaj/dfs/namesecondary/in_use.lock acquired by nodename 5270@rakeshbharadwaj-VirtualBox
19/02/26 12:38:51 WARN namenode.FSNamesystem: Encountered exception loading fsimage
java.io.IOException: NameNode is not formatted.
    at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:235)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.doImportCheckpoint(FSImage.java:580)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:311)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:978)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:685)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:585)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:645)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:819)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:803)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1500)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1566)
19/02/26 12:38:51 INFO mortbay.log: Stopped HttpServer2$SelectChannelConnectorWithSafeStartup@0.0.0.0:50070

因此,我已经通过运行hdfs namenode -format格式化了namenode。格式成功。格式化之后,形成了新图像 fsimage_0000000000000000000

现在,我再次运行hdfs namenode -importCheckpoint,它给了我以下错误。

19/02/26 12:30:47 WARN namenode.FSNamesystem: Encountered exception loading fsimage
java.io.IOException: Cannot import image from a checkpoint.  NameNode already contains an image in /home/rakeshbharadwaj/Desktop/hadoop-2.7.4-ex2/n
    at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverStorageDirs(FSImage.java:392)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:225)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:978)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:685)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:585)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:645)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:819)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:803)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1500)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1566)

问题:如何解决这个问题并从新目录中的检查点获取fsimage。

0 个答案:

没有答案