Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hadoop - namenode is not starting up

Tags:

hadoop

I am trying to run hadoop as a root user, i executed namenode format command hadoop namenode -format when the Hadoop file system is running.

After this, when i try to start the name node server, it shows error like below

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)

I tried to search for any solution, but cannot find any clear solution.

Can anyone suggest?

Thanks.

like image 784
balanv Avatar asked May 23 '13 11:05

balanv


People also ask

How do I start the NameNode in Hadoop?

By following methods we can restart the NameNode: You can stop the NameNode individually using /sbin/hadoop-daemon.sh stop namenode command. Then start the NameNode using /sbin/hadoop-daemon.sh start namenode. Use /sbin/stop-all.sh and the use /sbin/start-all.sh, command which will stop all the demons first.

What if NameNode fails in Hadoop?

If NameNode fails, the entire Hadoop cluster will fail. Actually, there will be no data loss, only the cluster job will be shut down because NameNode is just the point of contact for all DataNodes and if the NameNode fails then all communication will stop.

What happens if NameNode gets fails during executing job?

If Namenode gets down then the whole Hadoop cluster is inaccessible and considered dead. Datanode stores actual data and works as instructed by Namenode. A Hadoop file system can have multiple data nodes but only one active Namenode.


4 Answers

DFS needs to be formatted. Just issue the following command after stopping all and then restart.

hadoop namenode -format
like image 136
redTiger Avatar answered Oct 05 '22 23:10

redTiger


Cool, i have found the solution.

Stop all running server

1) stop-all.sh 

Edit the file /usr/local/hadoop/conf/hdfs-site.xml and add below configuration if its missing

<property>
    <name>dfs.data.dir</name>
    <value>/app/hadoop/tmp/dfs/name/data</value> 
    <final>true</final> 
    </property> 
    <property> 
    <name>dfs.name.dir</name>
    <value>/app/hadoop/tmp/dfs/name</value> 
    <final>true</final> 
</property>

Start both HDFS and MapReduce Daemons

2) start-dfs.sh
3) start-mapred.sh

Then now run the rest of the steps to run the map reduce sample given in this link

Note : You should be running the command bin/start-all.sh if the direct command is not running.

like image 21
balanv Avatar answered Oct 05 '22 22:10

balanv


format hdfs when namenode stop.(just like the top answer).

I add some more details.

FORMAT command will check or create path/dfs/name, and initialize or reinitalize it. then running start-dfs.sh would run namenode, datanode, then namesecondary. when namenode check not exist path/dfs/name or not initialize, it occurs a fatal error, then exit. that's why namenode not start up.

more details you can check HADOOP_COMMON/logs/XXX.namenode.log

like image 23
liuyang1 Avatar answered Oct 06 '22 00:10

liuyang1


Make sure the directory you've specified for your namenode is completely empty. Something like a "lost+found" folder in said directory will trigger this error.

like image 42
Eddie Avatar answered Oct 06 '22 00:10

Eddie