Initialization failed for Block pool <registering> (Datanode Uuid unassigned)

I met the same problem and solved it by doing the following steps:

step 1. remove the hdfs directory (for me it was the default directory "/tmp/hadoop-root/")

rm -rf /tmp/hadoop-root/*

step 2. run

bin/hdfs namenode -format

to format the directory


The issue arises because of mismatch of cluster ID's of datanode and namenode.

Follow these steps:

  1. GO to Hadoop_home/data/namenode/CURRENT and copy cluster ID from "VERSION".
  2. GO to Hadoop_home/data/datanode/CURRENT and paste this cluster ID in "VERSION" replacing the one present there.
  3. then format the namenode
  4. start datanode and namenode again.

The root cause of this is datanode and namenode clusterID different, please unify them with namenode clusterID then restart hadoop then it should be resolved.


there are 2 Possible Solutions to resolve

First:

Your namenode and datanode cluster ID does not match, make sure to make them the same.

In name node, change ur cluster id in the file located in:

$ nano HADOOP_FILE_SYSTEM/namenode/current/VERSION 

In data node you cluster id is stored in the file:

$ nano HADOOP_FILE_SYSTEM/datanode/current/VERSION

Second:

Format the namenode at all:

Hadoop 1.x: $ hadoop namenode -format

Hadoop 2.x: $ hdfs namenode -format