<code>2014</code><code>-</code><code>09</code><code>-</code><code>20</code> <code>08</code><code>:</code><code>08</code><code>:</code><code>54</code><code>,</code><code>179</code> <code>ERROR org.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesystem initialization failed.</code>
<code>java.io.IOException: NameNode is not formatted.</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:</code><code>331</code><code>)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:</code><code>104</code><code>)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:</code><code>427</code><code>)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:</code><code>395</code><code>)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:</code><code>299</code><code>)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:</code><code>569</code><code>)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:</code><code>1479</code><code>)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:</code><code>1488</code><code>)</code>
<code>2014</code><code>-</code><code>09</code><code>-</code><code>20</code> <code>08</code><code>:</code><code>08</code><code>:</code><code>54</code><code>,</code><code>199</code> <code>ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: java.io.IOException: NameNode is not formatted.</code>
解决方法:
格式化NameNode
<code>[root@hadoop bin]</code><code># ./hadoop namenode -format</code>
<code>13</code><code>/06/28</code> <code>22:50:23 INFO namenode.NameNode: STARTUP_MSG: </code>
<code>/************************************************************</code>
<code>STARTUP_MSG: Starting NameNode</code>
<code>STARTUP_MSG: host = java.net.UnknownHostException: hadoop: hadoop</code>
<code>STARTUP_MSG: args = [-</code><code>format</code><code>]</code>
<code>STARTUP_MSG: version = 0.20.2</code>
<code>STARTUP_MSG: build = https:</code><code>//svn</code><code>.apache.org</code><code>/repos/asf/hadoop/common/branches/branch-0</code><code>.20 -r 911707; compiled by </code><code>'chrisdo'</code> <code>on Fri Feb 19 08:07:34 UTC 2010</code>
<code>************************************************************/</code>
<code>13</code><code>/06/28</code> <code>22:50:23 INFO namenode.FSNamesystem: fsOwner=root,root</code>
<code>13</code><code>/06/28</code> <code>22:50:23 INFO namenode.FSNamesystem: supergroup=supergroup</code>
<code>13</code><code>/06/28</code> <code>22:50:23 INFO namenode.FSNamesystem: isPermissionEnabled=</code><code>true</code>
<code>13</code><code>/06/28</code> <code>22:50:38 INFO metrics.MetricsUtil: Unable to obtain hostName</code>
<code>java.net.UnknownHostException: hadoop: hadoop</code>
<code> </code><code>at java.net.InetAddress.getLocalHost(InetAddress.java:1354)</code>
<code> </code><code>at org.apache.hadoop.metrics.MetricsUtil.getHostName(MetricsUtil.java:91)</code>
<code> </code><code>at org.apache.hadoop.metrics.MetricsUtil.createRecord(MetricsUtil.java:80)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.FSDirectory.initialize(FSDirectory.java:73)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.FSDirectory.<init>(FSDirectory.java:68)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:379)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.NameNode.</code><code>format</code><code>(NameNode.java:854)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:948)</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:965)</code>
<code>13</code><code>/06/28</code> <code>22:50:38 INFO common.Storage: Image </code><code>file</code> <code>of size 94 saved </code><code>in</code> <code>0 seconds.</code>
<code>13</code><code>/06/28</code> <code>22:50:38 INFO common.Storage: Storage directory </code><code>/tmp/hadoop-root/dfs/name</code> <code>has been successfully formatted.</code>
<code>13</code><code>/06/28</code> <code>22:50:38 INFO namenode.NameNode: SHUTDOWN_MSG: </code>
<code>SHUTDOWN_MSG: Shutting down NameNode at java.net.UnknownHostException: hadoop: hadoop</code>
问题:
<code>2014</code><code>-</code><code>09</code><code>-</code><code>20</code> <code>08</code><code>:</code><code>02</code><code>:</code><code>32</code><code>,</code><code>476</code> <code>INFO org.apache.hadoop.hdfs.server.common.Storage: Storage directory /tmp/hadoop-root/dfs/name does not exist</code>
<code>2014</code><code>-</code><code>09</code><code>-</code><code>20</code> <code>08</code><code>:</code><code>02</code><code>:</code><code>32</code><code>,</code><code>480</code> <code>ERROR org.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesystem initialization failed.</code>
<code>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.</code>
<code> </code><code>at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:</code><code>304</code><code>)</code>
<code>2014</code><code>-</code><code>09</code><code>-</code><code>20</code> <code>08</code><code>:</code><code>02</code><code>:</code><code>32</code><code>,</code><code>494</code> <code>ERROR org.apache.hadoop.hdfs.server.namenode.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.</code>
<code>2014</code><code>-</code><code>09</code><code>-</code><code>20</code> <code>08</code><code>:</code><code>02</code><code>:</code><code>32</code><code>,</code><code>495</code> <code>INFO org.apache.hadoop.hdfs.server.namenode.NameNode: SHUTDOWN_MSG: </code>
<code>SHUTDOWN_MSG: Shutting down NameNode at localhost/127.0.0.1</code>
解决:
<code>mkidr -pv </code><code>/tmp/hadoop-root/dfs/name</code>
本文转自 梦朝思夕 51CTO博客,原文链接:http://blog.51cto.com/qiangmzsx/1556336