Hadoop1.2.1 在关机重启后,namenode启动报错:
2018-10-15 19:41:25,850 ERROR org.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesystem initialization failed.
org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /usr/local/src/hadoop-1.2.1/temp/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:304)
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)
发现是因为临时文件hadoop下的 /tmp会被删除掉,解决方法就是修改core-site.xml,添加hadoop.tmp.dir属性:
<property>
<name>hadoop.tmp.dir</name>
<value>/home/fzuir/Hadoop1.2.1/tmp/hadoop-${user.name}</value>
</property
再次启动hadoop就不会出现/dfs/name is in an inconsistent state的错误了
[root@master bin]# jps
47282 Jps
37538 DataNode
89669 NameNode
89818 SecondaryNameNode
离线