| |

How to force a metadata checkpointing in HDFS

The metadata checkpointing in HDFS is done by the Secondary NameNode to merge the fsimage and the edits log files periodically and keep edits log size within a limit. For various reasons, the checkpointing by the Secondary NameNode may fail. For one example, HDFS SecondaraNameNode log shows errors in its log as follows.

2017-08-06 10:54:14,488 ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in doCheckpoint
java.io.IOException: Inconsistent checkpoint fields.
  LV = -63 namespaceID = 1920275013 cTime = 0 ; clusterId = CID-f38880ba-3415-4277-8abf-b5c2848b7a63 ; blockpoolId = BP-578888813-10.6.1.2-1497278556180.
  Expecting respectively: -63; 263120692; 0; CID-d22222fd-e28a-4b2d-bd2a-f60e1f0ad1b1; BP-622207878-10.6.1.2-1497242227638.
  at org.apache.hadoop.hdfs.server.namenode.CheckpointSignature.validateStorageInfo(CheckpointSignature.java:134)
  at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doCheckpoint(SecondaryNameNode.java:531)
  at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doWork(SecondaryNameNode.java:395)
  at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$1.run(SecondaryNameNode.java:361)
  at org.apache.hadoop.security.SecurityUtil.doAsLoginUserOrFatal(SecurityUtil.java:415)
  at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.run(SecondaryNameNode.java:357)

This post introduces how to force a metadata checkpointing in HDFS.

Step one: Save latest HDFS metadata to the fsimage by the NameNode

On the NameNode, save latest metadata to the fsimage as the HDFS super user (e.g. the user that runs the HDFS daemons) by running following commands:

$ hdfs dfsadmin -safemode enter
$ hdfs dfsadmin -safemode get # to confirm and ensure it is in safemode
$ hdfs dfsadmin -saveNamespace
$ hdfs dfsadmin -safemode leave

Step two: clean the Secondary NameNode old data dir

On the Secondary NameNode as the HDFS super user, stop Secondary NameNode service.

$ hadoop-daemon.sh stop secondarynamenode

Use jps to make sure the secondarynamenode process is indeed stopped.

Find out the value of dfs.namenode.checkpoint.dir for the Secondary NameNode:

$ hdfs getconf -confKey dfs.namenode.checkpoint.dir

An example output is

file:///home/hadoop/tmp/dfs/namesecondary

Then, move/rename the current dir under dfs.namenode.checkpoint.dir so that it can be rebuilt again. For the above example, the command will be

$ mv /home/hadoop/tmp/dfs/namesecondary /home/hadoop/tmp/dfs/namesecondary.old

Step three: force a HDFS metadata checkpointing by the Secondary NameNode

Run following command on the Secondary NameNode:

$ hdfs secondarynamenode -checkpoint force

Then start the secondarynamenode back

$ hadoop-daemon.sh start secondarynamenode

All should be back now.

Similar Posts

  • What is Double-Blind review for a paper?

    I want to submit my paper to NAS 2015 but I am confused about its double-blind review 盲审又包括单盲审(Single-Blind Peer Review, SBPR)和双盲审(Double-Blind Peer Review, DBPR)。双盲审是审者与作者之间互相都不知道彼此身份的匿名评审。在双盲审的过程中,中间组织者的规范和保密工作很重要。单盲审一般是审者知道作者的身份,而作者不知道审者是谁。 计算机有不少会议实行双盲评审。 Reference: http://emuch.net/html/201104/3022021.html Read more: When should the authors anonymize themselves in a paper submitted to a conference for review? How to write paper reviews? How to convert A4 paper format…

  • Auto completion in Vim

    How to enable auto code completion in Vim, like in the IDE? Several plugins I use: snipMate: Plugin for using TextMate-style snippets in Vim omnicppcomplete: Plugin for C/C++ omnicompletion neocomplcache: Ultimate auto completion system for Vim Read more: How to enable Email address auto completion in Evolution? Profiling Vim to Find Out Which Plugin Makes…

  • Free server images – SysTutorials QA

    Any free server images? 24 Free Data Center Photos from fatcow.com 24 Free Data Center Photos: http://www.fatcow.com/data-center-photos From Wikimedia commons: Multiple servers: http://commons.wikimedia.org/wiki/File:Server-multiple.svg Server: http://commons.wikimedia.org/wiki/File:Server.svg Yellow server: http://commons.wikimedia.org/wiki/File:Server-yellow.svg Green server: http://commons.wikimedia.org/wiki/File:Server-green.svg More from clker.com: Web Virtualization Server clip art: http://www.clker.com/clipart-1826.html Small Case Web Mail Server clip art: http://www.clker.com/clipart-1902.html Inside our data centers from Google —…

  • Cryptographic token 101

    Cryptographic tokens, or crypto tokens, are tradable digital units of assets that reside on blockchains. These tokens have become increasingly popular in recent years due to the rise of cryptocurrencies and the growing interest in non-fungible tokens (NFTs). Both fungible and non-fungible tokens play a significant role in the world of blockchain technology and digital…

Leave a Reply

Your email address will not be published. Required fields are marked *