Failed to start namenode,Directory /tmp/hadoop-root/dfs/name is in an inconsistent state

Posted Mr.zhou_Zxy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Failed to start namenode,Directory /tmp/hadoop-root/dfs/name is in an inconsistent state相关的知识,希望对你有一定的参考价值。

启动Hadoop报如下错误:

    2021-08-04 10:05: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)

问题分析:

    	1.Linux系统在每次重启后,hadoop不能正藏启动namenode,需要格式化之后才能再次启动
    	2.初步认定为namenode格式化问题
    	3.可能引发这样问题的原因是hadoop的默认格式化路径在/tmp下,但是这个目录每次重启的时候都会被清空,导致namenode格式化
    出错,而且多次格式化后,也可能回引起hadoop集群的问题。所以必须解决这个问题。

处理方法:

修改hadoop下的core-site.xml

     <!-- hadoop的内部的数据或者元数据真实的存放路径 -->
            <property>
                    <name>hadoop.tmp.dir</name>
                    <value>/opt/apps/hadoop-2.8.1/hdpdata</value>
            </property>

修改好之后,手动格式化namenode

hdfs namenode -format

以上是关于Failed to start namenode,Directory /tmp/hadoop-root/dfs/name is in an inconsistent state的主要内容,如果未能解决你的问题,请参考以下文章

解决ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: Failed to start namenode.java.net.BindExce

Failed to start namenode,Directory /tmp/hadoop-root/dfs/name is in an inconsistent state

格式化namenode时 报错 No Route to Host from node1/192.168.1.111 to node3:8485 failed on socket timeout ex

启动hadoop报ERROR org.apache.hadoop.hdfs.server.namenode.FSImage: Failed to load image from FSImageFile

GTA4运行出现SecuLauncher:failed to start application

Starting zookeeper ... FAILED TO START