Hadoop Namenode不能启动(dfs/name is in an inconsistent state)

org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /tmp/hadoop-javoft/dfs/name is in an inconsistent state: storage di rectory does not exist or is not accessible.
at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:291)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:97)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:379)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.(FSNamesystem.java:353)
at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:254)
at org.apache.hadoop.hdfs.server.namenode.NameNode.(NameNode.java:434)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1153)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1162)
2011-07-23 12:48:43,125 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: org.apache.hadoop.hdfs.server.common.InconsistentFSStateException : Directory /tmp/hadoop-javoft/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.
at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:291)
at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:97)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:379)
at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.(FSNamesystem.java:353)
at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:254)
at org.apache.hadoop.hdfs.server.namenode.NameNode.(NameNode.java:434)
at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1153)
at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1162)

 

2011-07-23 12:48:43,126 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: SHUTDOWN_MSG: 

Directory does not exist?但是为什么刚装完时是存在的呢,抱着试试看的态度,再次执行。

hadoop namenode -format

执行之后再启动,namenode启动成功了,说明上面does not exist的目录在format namenode的时候重新建起来了,但是如果每次重启都要format namenode,也太不靠谱了,不止是麻烦,更大的麻烦是里面的数据不能总被无情的delete掉啊,问题必须解决。

Directory /tmp/hadoop-javoft/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.这里的目录既然是在tmp下面的,回忆一下,tmp目录下的文件是临时文件会被定期删除的,貌似bug已经露出水面。那就重启计算机试试是不是因为这,重启之前检查一下tmp目录下面确定几个format namenode之后应该有的目录都有的,重启之后,发现全部被删掉。在执行一次 start-dfs.sh,看到tmp目录下面建了一些目录,但是dfs/name目录仍然不存在,在start-dfs.sh时候建了一部分目录和文件。而dfs/name需要在hadoop namenode -format时建立。问题清楚了。

解决方案就很简单,这些目录的位置都是根据hadoop.tmp.dir的位置确定的,所以只需要在conf/core-site.xml覆盖hadoop.tmp.dir的默认值即可:

...

<property>

   <name>hadoop.tmp.dirname>

   <value>/home/javoft/Documents/hadoop/hadoop-${user.name}value>

   <description>A base for other temporary directories.description>

property>

...

如此问题解决。。。

你可能感兴趣的:(Hadoop Namenode不能启动(dfs/name is in an inconsistent state))