hadoop-1.2.1 namenode is not formatted

时间:2017-03-02 23:49:15

标签: ubuntu hadoop hdfs namenode

I have installed hadoop 1.2.1 in Ubuntu 16 and configured as below:

core-site.xml

<property>
    <name>fs.default.name</name>
    <value>hdfs://localhost:8020</value>
</property>
<property>
    <name>hadoop.tmp.dir</name>
    <value>tmpDir/snadikop/hadoopdata</value>

hdfs-site.xml

<configuration>
<property>
    <name>dfs.replication</name>
    <value>1</value>
</property>

mapred-site.xml

<configuration>
<property>
    <name>mapred.job.tracker</name>
    <value>localhost:8021</value>
</property>

when I started first time, everything's working fine. but when I restarted the system, and when I tried to start the daemons namenode is not starting.

tried

hadoop namenode -format 

command and tried

sudo chown snadikop tmpDir/snadikop/hadoopdata
sudo chmod 750 tmpDir/snadikop/hadoopdata

where snadikop is the user. Still couldn't solve this issue. please help me with this issue?

Thank you.

Below is my log file

2017-03-02 18:07:01,185 ERROR org.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesystem initialization failed.
java.io.IOException: NameNode is not formatted.
    at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:331)
    at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:104)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:427)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:395)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:299)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:569)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1479)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1488)
2017-03-02 18:07:01,377 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: java.io.IOException: NameNode is not formatted.
    at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:331)
    at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:104)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:427)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:395)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:299)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:569)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1479)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1488)

2017-03-02 18:07:01,411 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: SHUTDOWN_MSG: 

and this is what happening in the terminal

snadikop@satish-vb:~$ jps
11492 NameNode
11654 DataNode
11863 Jps
11818 SecondaryNameNode
snadikop@satish-vb:~$ jps
11654 DataNode
11880 Jps
11818 SecondaryNameNode
snadikop@satish-vb:~$ 

below are the screenshots locations of 'name' and 'data' folders. 'name' folder path I have doubt regarding this, whether both has to be in same folder or not.

'data' folder path

1 个答案:

答案 0 :(得分:0)

您向hadoop.tmp.dir提供的值是一个相对路径,每次都会根据调用start脚本的路径进行更改。 如果未在hadoop.tmp.dir中明确设置,则此dfs.name.dir目录路径将成为dfs.data.dirhdfs-site.xml的基本路径。

因此,如果tmp.dir发生更改,则namenode的名称目录会更改,从而更改Namenode is not formatted错误。

使用绝对非hdfs-site.xml路径

将这些属性添加到tmp
<property>
   <name>dfs.name.dir</name>
   <value>/home/username/namenode</value>
</property>
<property>
   <name>dfs.data.dir</name>
   <value>/home/username/datanode</value>
</property>

然后format namenode

hadoop namenode -format

同时将hadoop.tmp.dir的值修改为绝对路径,以便随机停止创建tmp目录。