解决方案:datanode无法启动之"Incompatible namespaceIDs in ..."

时间:2023-01-21 11:54:22

启动hadoop的时候,datanode无法启动,使用如下命令查看日志信息:


tail -100f /usr/local/hadoop/libexec/../logs/hadoop-hadoop-datanode-master.log


提示以下错误:

ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs in /data/hadoop/hdfs/data: namenode namespaceID = 1265744122; datanode namespaceID = 908607799


原因:每次namenode format会重新创建一个namenodeId,而/data/hadoop/hdfs/data下包含了上次format下的id,namenode format清空了namenode下的数据,但是没有晴空datanode下的数据,导致启动时失败,所要做的就是每次fotmat前,清空/data/hadoop/hdfs/data以下 的所有目录.


[hadoop@master name]$ cd /data/hadoop/hdfs[hadoop@master hdfs]$ lltotal 16drwxr-xr-x 6 hadoop hadoop 4096 Apr 22 18:42 datadrwxrwxr-x 5 hadoop hadoop 4096 Apr 22 18:42 name


[root@master hdfs]# rm -rf data/*[root@master hdfs]# su hadoop


[hadoop@master root]$ jps12426 Jps11532 JobTracker11278 NameNode11675 TaskTracker[hadoop@master root]$ stop-all.shWarning: $HADOOP_HOME is deprecated.stopping jobtrackermaster: stopping tasktrackernode1: stopping tasktrackerstopping namenodemaster: no datanode to stopnode1: no datanode to stopnode1: stopping secondarynamenode[hadoop@master root]$ start-all.shWarning: $HADOOP_HOME is deprecated.starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-namenode-master.outnode1: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-datanode-node1.outmaster: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-datanode-master.outnode1: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-secondarynamenode-node1.outstarting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-jobtracker-master.outmaster: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-tasktracker-master.outnode1: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-tasktracker-node1.out[hadoop@master root]$ jps13035 JobTracker13243 Jps13157 TaskTracker12911 DataNode


此时发现DataNode启动起来了,但是NameNode却不见了,莫慌,重新格式化以下namenode即可。


[hadoop@master hadoop]$ stop-all.shWarning: $HADOOP_HOME is deprecated.stopping jobtrackermaster: stopping tasktrackernode1: stopping tasktrackerno namenode to stopmaster: stopping datanodenode1: stopping datanodenode1: stopping secondarynamenode[hadoop@master hadoop]$ jps13581 Jps[hadoop@master hadoop]$ hadoop namenode -formatWarning: $HADOOP_HOME is deprecated.14/04/22 18:52:54 INFO namenode.NameNode: STARTUP_MSG:/************************************************************STARTUP_MSG: Starting NameNodeSTARTUP_MSG:   host = master/192.168.1.100STARTUP_MSG:   args = [-format]STARTUP_MSG:   version = 1.1.2STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.1 -r 1440782; compiled by 'hortonfo' on Thu Jan 31 02:03:24 UTC 2013************************************************************/14/04/22 18:52:54 INFO util.GSet: VM type       = 32-bit14/04/22 18:52:54 INFO util.GSet: 2% max memory = 0.61875 MB14/04/22 18:52:54 INFO util.GSet: capacity      = 2^17 = 131072 entries14/04/22 18:52:54 INFO util.GSet: recommended=131072, actual=13107214/04/22 18:52:54 INFO namenode.FSNamesystem: fsOwner=hadoop14/04/22 18:52:54 INFO namenode.FSNamesystem: supergroup=supergroup14/04/22 18:52:54 INFO namenode.FSNamesystem: isPermissionEnabled=false14/04/22 18:52:54 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=10014/04/22 18:52:54 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)14/04/22 18:52:54 INFO namenode.NameNode: Caching file names occuring more than 10 times14/04/22 18:52:55 INFO common.Storage: Image file of size 112 saved in 0 seconds.14/04/22 18:52:55 INFO namenode.FSEditLog: closing edit log: position=4, editlog=/data/hadoop/hdfs/name/current/edits14/04/22 18:52:55 INFO namenode.FSEditLog: close success: truncate to 4, editlog=/data/hadoop/hdfs/name/current/edits14/04/22 18:52:55 INFO common.Storage: Storage directory /data/hadoop/hdfs/name has been successfully formatted.14/04/22 18:52:55 INFO namenode.NameNode: SHUTDOWN_MSG:/************************************************************SHUTDOWN_MSG: Shutting down NameNode at master/192.168.1.100************************************************************/[hadoop@master hadoop]$ jps13631 Jps[hadoop@master hadoop]$ start-all.shWarning: $HADOOP_HOME is deprecated.starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-namenode-master.outnode1: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-datanode-node1.outmaster: starting datanode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-datanode-master.outnode1: starting secondarynamenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-secondarynamenode-node1.outstarting jobtracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-jobtracker-master.outnode1: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-tasktracker-node1.outmaster: starting tasktracker, logging to /usr/local/hadoop/libexec/../logs/hadoop-hadoop-tasktracker-master.out[hadoop@master hadoop]$ jps13699 NameNode13972 JobTracker14107 TaskTracker13823 DataNode14179 Jps


发现,所有的节点已经启动起来了,OK,大功告成!




本文出自 “大白菜” 博客,请务必保留此出处http://dreamylights.blog.51cto.com/1163218/1400927