Incompatible Namespace IDs in Namenode and Datanode

When the NameNode is formatted a namespace ID is generated, which essentially identifies that specific instance of the distributed filesystem. When DataNodes first connect to the NameNode they store that namespace ID along with the data blocks, because the blocks have to belong to a specific filesystem.

If a DataNode later connects to a NameNode, and the namespace ID which the NameNode declares does not match the namespace ID stored on the DataNode, it will refuse to operate with the “incompatible namespace ID” error. It means that the DataNode has connected to a different NameNode, and the blocks which it is storing don’t belong to that distributed filesystem.

This usually means that you’ve misplaced your NameNode metadata somehow. If you have multiple HDFS installations your DataNode may be connecting to the wrong NameNode. If you only have a single installation then your NameNode is either running with a different metadata directory, or you’ve somehow lost the metadata and started with a newly formatted filesystem (which should only happen by running hadoop namenode -format).

 

Solution:

You must have set a property “hadoop.tmp.dir” in core-site.xml file in hadoop conf folder. Go to the directory pointed by the value of this property. There you can find two folders,

  • name
  • data

copy the namespace id in the name/dfs/current/VERSION file to the data/dfs/current/VERSION file. Similarly correct this on all datanode machines.

Note: If you cant find the above property then you must have set two different paths for these two with the properties “hadoop.name.dir” and “hadoop.data.dir”. Follow the same steps to correct the problem.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s