After hadoop system reboot, namenode can not boot

Problem Description: hadoop system after the restart, perform sbin / start_dfs.sh startup script

[hadoop@ruozedata001 hadoop]$ jps
6033 Jps
5304 SecondaryNameNode
5119 DataNode
[hadoop@ruozedata001 hadoop]$ 
namenode始终起不来

View namenode logs, being given as follows

tail -F  /home/hadoop/software/hadoop-2.6.0-cdh5.7.0/logs/hadoop-hadoop-namenode-ruozedata001.log
 	2019-07-05 10:39:35,828 INFO org.apache.hadoop.hdfs.server.namenode.NNConf: Maximum size of an xattr: 16384
2019-07-05 10:39:35,828 WARN org.apache.hadoop.hdfs.server.common.Storage: Storage directory /data/tmp/hadoop-hadoop/dfs/name does not exist
2019-07-05 10:39:35,829 WARN org.apache.hadoop.hdfs.server.namenode.FSNamesystem: Encountered exception loading fsimage
org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /data/tmp/hadoop-hadoop/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:314)
        at org.apache.hadoop.hdfs.server.namenode.FSImage.recoverTransitionRead(FSImage.java:202)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFSImage(FSNamesystem.java:1063)
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.loadFromDisk(FSNamesystem.java:767)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.loadNamesystem(NameNode.java:609)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.initialize(NameNode.java:670)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:838)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.<init>(NameNode.java:817)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1538)
        at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1606)
2019-07-05 10:39:35,832 INFO org.mortbay.log: Stopped [email protected]:50070
2019-07-05 10:39:35,933 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Stopping NameNode metrics system...
2019-07-05 10:39:35,933 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: NameNode metrics system stopped.
2019-07-05 10:39:35,933 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: NameNode metrics system shutdown complete.
2019-07-05 10:39:35,933 ERROR org.apache.hadoop.hdfs.server.namenode.NameNode: Failed to start namenode.
org.apache.hadoop.hdfs.server.common.InconsistentFSStateException: Directory /data/tmp/hadoop-hadoop/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:314)

The solution is to start the implementation of hadoop namenode -formatthe namenode re-format the next (not recommended for use on production, because this would NameNode said data deleted), but do not think about it later, so every format, it is not game over - - and then found the next, found that because the temporary file / tmp will be deleted as follows: under / tmp / hadoop-hadoop / dfs / directory, folder does not exist namenode

[hadoop@ruozedata001 dfs]$ cd /tmp/hadoop-hadoop/dfs/
[hadoop@ruozedata001 dfs]$ pwd
/tmp/hadoop-hadoop/dfs
[hadoop@ruozedata001 dfs]$ ll
total 0
drwx------ 2 hadoop hadoop  6 Jul  5 09:54 data
drwxrwxr-x 3 hadoop hadoop 20 Jul  5 10:39 namesecondary
[hadoop@ruozedata001 dfs]$ 

The solution is to modify the configuration file core-site.xml, add hadoop.tmp.dir attributes: Defining the storage head back to where it will not be deleted

<configuration>
	<property>
			<name>hadoop.tmp.dir</name>
		  <value>/data/tmp/hadoop-${user.name}</value>
	</property>
</configuration>

Then execute again sbin/start_dfs.shstartup script, you can start the process of normal namenode.

Recommendation: To avoid this fault, configuration deployment in hadoop environment when it directly to the configuration file core-site.xml to redefine the hadoop.tmp.dir directory where it will not be deleted.

Guess you like

Origin blog.csdn.net/whiteblacksheep/article/details/94722734