hadoop啓動後,jps命令後發現nodename啓動失敗,檢查日誌報錯:FSNamesystem initialization failed

1. 基本信息html

hadoop    版本 hadoop-0.20.205.0.tar.gzjava

操做系統   ubuntunode

 

2. 問題linux

在使用Hadoop開發初期的時候遇到一個問題。 每次重啓系統後發現不能正常運行hadoop。必須執行  bin/hadoop namenode -format  進行格式化才能成功運行hadoop,可是也就意味着之前記錄的name等數據丟失。web

 查詢日誌發現錯誤: apache

 

  1. 21:08:48,103 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Registered FSNamesystemStateMBean and NameNodeMXBean  
  2. 21:08:48,125 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: Caching file names occuring more than 10 times   
  3. 21:08:48,129 INFO org.apache.hadoop.hdfs.server.common.Storage: Storage directory /tmp/hadoop-sylar/dfs/name does not exist.  
  4. 21:08:48,130 ERROR org.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesystem initialization failed.  
  5. org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /tmp/hadoop-sylar/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.  
  6.     at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:288)  
  7.     at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:97)  
  8.     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:384)  
  9.     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:358)  
  10.     at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:276)  
  11.     at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:497)  
  12.     at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1268)  
  13.     at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1277)  



 

3.緣由ubuntu

後查詢文檔時發現, 在linux下hadoop等的各類數據保存在/tmp目錄下。 當重啓系統後/tmp目錄中的數據信息被清除,致使hadoop啓動失敗。 當bin/hadoop namenode -format 格式化後,恢復了默認設置,便可正常啓動。ide

 

4. 解決oop

 須要在配置文件core-site.xml中指定臨時目錄的存儲位置, 現貼出修改後的配置this

 

 

  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   
  4. <!-- Put site-specific property overrides in this file. -->  
  5.   
  6. <configuration>  
  7.   
  8. <property>  
  9.          <name>fs.default.name</name>  
  10.          <value>hdfs://127.0.0.1:9000</value>  
  11.      </property>  
  12.   
  13. <property>  
  14.     <name>hadoop.tmp.dir</name>  
  15.     <value>/home/hadoopdata/tmp</value>  
  16.     <description>A base for other temporary directories.</description>  
  17. </property>  
  18.    
  19. <property>  
  20.     <name>dfs.name.dir</name>  
  21.     <value>/home/hadoopdata/filesystem/name</value>  
  22.     <description>Determines where on the local filesystem the DFS name node should store the name table. If this is a comma-delimited list of directories then the name table is replicated in all of the directories, for redundancy. </description>  
  23. </property>  
  24.    
  25. <property>  
  26.     <name>dfs.data.dir</name>  
  27.     <value>/home/hadoopdata/filesystem/data</value>  
  28.     <description>Determines where on the local filesystem an DFS data node should store its blocks. If this is a comma-delimited list of directories, then data will be stored in all named directories, typically on different devices. Directories that do not exist are ignored.</description>  
  29. </property>  
  30.    
  31. <property>  
  32.     <name>dfs.replication</name>  
  33.     <value>1</value>  
  34.     <description>Default block replication. The actual number of replications can be specified when the file is created. The default isused if replication is not specified in create time.</description>  
  35. </property>  
  36.   
  37. </configuration>  

 

 

 

dfs.name.dir是NameNode持久存儲名字空間及事務日誌的本地文件系統路徑。當這個值是一個逗號分割的目錄列表時,nametable數據將會被複制到全部目錄中作冗餘備份。

dfs.data.dir是DataNode存放塊數據的本地文件系統路徑,逗號分割的列表。當這個值是逗號分割的目錄列表時,數據將被存儲在全部目錄下,一般分佈在不一樣設備上。

dfs.replication是數據須要備份的數量,默認是3,若是此數大於集羣的機器數會出錯。

注意:此處的name一、name二、data一、data2目錄不能預先建立,hadoop格式化時會自動建立,若是預先建立反而會有問題。

1. 基本信息

hadoop    版本 hadoop-0.20.205.0.tar.gz

操做系統   ubuntu

 

2. 問題

在使用Hadoop開發初期的時候遇到一個問題。 每次重啓系統後發現不能正常運行hadoop。必須執行  bin/hadoop namenode -format  進行格式化才能成功運行hadoop,可是也就意味着之前記錄的name等數據丟失。

 查詢日誌發現錯誤: 

 

  1. 21:08:48,103 INFO org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Registered FSNamesystemStateMBean and NameNodeMXBean  
  2. 21:08:48,125 INFO org.apache.hadoop.hdfs.server.namenode.NameNode: Caching file names occuring more than 10 times   
  3. 21:08:48,129 INFO org.apache.hadoop.hdfs.server.common.Storage: Storage directory /tmp/hadoop-sylar/dfs/name does not exist.  
  4. 21:08:48,130 ERROR org.apache.hadoop.hdfs.server.namenode.FSNamesystem: FSNamesystem initialization failed.  
  5. org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /tmp/hadoop-sylar/dfs/name is in an inconsistent state: storage directory does not exist or is not accessible.  
  6.     at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:288)  
  7.     at org.apache.hadoop.hdfs.server.namenode.FSDirectory.loadFSImage(FSDirectory.java:97)  
  8.     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.initialize(FSNamesystem.java:384)  
  9.     at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.<init>(FSNamesystem.java:358)  
  10.     at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:276)  
  11.     at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:497)  
  12.     at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1268)  
  13.     at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1277)  



 

3.緣由

後查詢文檔時發現, 在linux下hadoop等的各類數據保存在/tmp目錄下。 當重啓系統後/tmp目錄中的數據信息被清除,致使hadoop啓動失敗。 當bin/hadoop namenode -format 格式化後,恢復了默認設置,便可正常啓動。

 

4. 解決

 須要在配置文件core-site.xml中指定臨時目錄的存儲位置, 現貼出修改後的配置

 

 

  1. <?xml version="1.0"?>  
  2. <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>  
  3.   
  4. <!-- Put site-specific property overrides in this file. -->  
  5.   
  6. <configuration>  
  7.   
  8. <property>  
  9.          <name>fs.default.name</name>  
  10.          <value>hdfs://127.0.0.1:9000</value>  
  11.      </property>  
  12.   
  13. <property>  
  14.     <name>hadoop.tmp.dir</name>  
  15.     <value>/home/hadoopdata/tmp</value>  
  16.     <description>A base for other temporary directories.</description>  
  17. </property>  
  18.    
  19. <property>  
  20.     <name>dfs.name.dir</name>  
  21.     <value>/home/hadoopdata/filesystem/name</value>  
  22.     <description>Determines where on the local filesystem the DFS name node should store the name table. If this is a comma-delimited list of directories then the name table is replicated in all of the directories, for redundancy. </description>  
  23. </property>  
  24.    
  25. <property>  
  26.     <name>dfs.data.dir</name>  
  27.     <value>/home/hadoopdata/filesystem/data</value>  
  28.     <description>Determines where on the local filesystem an DFS data node should store its blocks. If this is a comma-delimited list of directories, then data will be stored in all named directories, typically on different devices. Directories that do not exist are ignored.</description>  
  29. </property>  
  30.    
  31. <property>  
  32.     <name>dfs.replication</name>  
  33.     <value>1</value>  
  34.     <description>Default block replication. The actual number of replications can be specified when the file is created. The default isused if replication is not specified in create time.</description>  
  35. </property>  
  36.   
  37. </configuration>  

 

 

 

dfs.name.dir是NameNode持久存儲名字空間及事務日誌的本地文件系統路徑。當這個值是一個逗號分割的目錄列表時,nametable數據將會被複制到全部目錄中作冗餘備份。

dfs.data.dir是DataNode存放塊數據的本地文件系統路徑,逗號分割的列表。當這個值是逗號分割的目錄列表時,數據將被存儲在全部目錄下,一般分佈在不一樣設備上。

dfs.replication是數據須要備份的數量,默認是3,若是此數大於集羣的機器數會出錯。

注意:此處的name一、name二、data一、data2目錄不能預先建立,hadoop格式化時會自動建立,若是預先建立反而會有問題。

相關文章
相關標籤/搜索