Hadoop错误:Directory /tmp/hadoop-root/dfs/name is in an inconsistent state

Error message:

Directory /tmp/hadoop-root/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.

问题:

Linux系统每次重新启动后,hadoop不能正常启动namenode,需要重新格式化namenode才可启动

原因:

hadoop默认将namenode格式化在/tmp下,而这个目录当在重启时会被清空,所以报错。

解决方案:

vim /usr/local/hadoop/etc/hadoop/core-site.xml
#add code

          hadoop.tmp.dir
          /var/hadoop

#reformat namenode
hdfs namenode -format

 

Error Message Detail:

2019-04-05 06:38:28,443 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: Failed to start namenode.
org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /tmp/hadoop-root/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.
        at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverStorageDirs(FSImage.java:327)
        at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:215)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:975)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:681)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:585)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:645)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.(NameNode.java:812)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.(NameNode.java:796)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1493)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1559)
2019-04-05 06:38:28,446 INFO org.apache.hadoop.util.ExitUtil: Exiting with status 1
2019-04-05 06:38:28,448 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at master/192.168.31.110
************************************************************/

 

转载于:https://my.oschina.net/jerval/blog/3032847

你可能感兴趣的:(Hadoop错误:Directory /tmp/hadoop-root/dfs/name is in an inconsistent state)