FSNamesystem initialization failed - Big Data In Real World

FSNamesystem initialization failed

Hadoop safemode recovery – taking too long!
January 12, 2017
DataNode process killed due to Incompatible clusterIDs error
January 19, 2017

FSNamesystem initialization failed

FSNamesystem initialization failed is a common error Hadoop users gets especially if there are trying to set up of a Hadoop cluster for the very first time.

13/05/23 04:11:37 ERROR namenode.FSNamesystem: FSNamesystem initialization failed.

java.io.IOException: NameNode is not formatted.

       at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:330)

       at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:100)

       at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:411)

Check the values for below 2 properties in hdfs-site.xml 

<property>
   <name>dfs.namenode.name.dir</name>
   <value>file:///data/1/dfs/nn</value>
</property>

<property>
   <name>dfs.datanode.data.dir</name>
   <value>file:///data/1/dfs/dn</value>
</property>

Directory location specified in dfs.namenode.name.dir  must present in NameNode’s local filesystem. Directory location specified in dfs.datanode.data.dir  must present in all DataNodes’ local filesystem.

If you don’t see them present. Stop all running Hadoop process. Create the missing directories in NameNode and DataNodes respectively. Make sure the folders are permissioned properly. Use the below commands for reference.

On NameNode

sudo mkdir -p /data/1/dfs/nn
sudo chown -R hdfs:hdfs /data/1/dfs/nn
sudo chmod 700 /data/1/dfs/nn

On DataNodes

sudo mkdir -p /data/1/dfs/dn
sudo chown -R hdfs:hdfs /data/1/dfs/dn

Once the directories are created, format the NameNode by executing the below command in the NameNode.

sudo -u hdfs hdfs namenode -format

Now you are ready to start the NameNode. Once the NameNode is started, check the logs and make sure you don’t see any erros. Once NameNode is successfully started, start all the DataNodes.

Big Data In Real World
Big Data In Real World
We are a group of Big Data engineers who are passionate about Big Data and related Big Data technologies. We have designed, developed, deployed and maintained Big Data applications ranging from batch to real time streaming big data platforms. We have seen a wide range of real world big data problems, implemented some innovative and complex (or simple, depending on how you look at it) solutions.

Comments are closed.

gdpr-image
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.

Hadoop In Real World is now Big Data In Real World!

X