首页 > 代码库 > datanode启动失败
datanode启动失败
当我动态加入一个hadoop从节点的之后,出现了一个问题:
[root@hadoop current]# hadoop-daemon.sh start datanode
starting datanode, logging to /usr/local/hadoop1.1/libexec/../logs/hadoop-root-datanode-hadoop.out
starting datanode, logging to /usr/local/hadoop1.1/libexec/../logs/hadoop-root-datanode-hadoop.out
[root@hadoop ~]# jps
jps命令发现没有datanode启动。所以去它提示的路径下查看了hadoop-root-datanode-hadoop.out文件,能够是空白的。
后来在该路径下发现了/usr/local/hadoop1.1/logs/hadoop-root-datanode-hadoop.log文件
查看日志文件
[root@hadoop current]# vim /usr/local/hadoop1.1/logs/hadoop-root-datanode-hadoop.log
STARTUP_MSG: version = 1.1.2
STARTUP_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
************************************************************/
2014-10-31 19:24:28,543 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2014-10-31 19:24:28,565 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2014-10-31 19:24:28,566 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2014-10-31 19:24:28,566 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2014-10-31 19:24:28,728 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2014-10-31 19:24:29,221 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs in /usr/local/hadoop/tmp/dfs/data: namenode namespaceID = 942590743; datanode namespaceID = 463031076
at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:232)
at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:147)
at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:399)
at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:309)
at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1651)
at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1590)
at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1608)
at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:1734)
at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1751)
2014-10-31 19:24:29,229 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at hadoop/192.168.0.100
************************************************************/
STARTUP_MSG: version = 1.1.2
STARTUP_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
************************************************************/
2014-10-31 19:24:28,543 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2014-10-31 19:24:28,565 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2014-10-31 19:24:28,566 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2014-10-31 19:24:28,566 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2014-10-31 19:24:28,728 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2014-10-31 19:24:29,221 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs in /usr/local/hadoop/tmp/dfs/data: namenode namespaceID = 942590743; datanode namespaceID = 463031076
at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:232)
at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:147)
at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:399)
at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:309)
at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1651)
at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1590)
at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1608)
at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:1734)
at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1751)
2014-10-31 19:24:29,229 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at hadoop/192.168.0.100
************************************************************/
读日志文件:
先看到ERROT信息中Incompatible这个单词,意思是“不相容的”。所以我们能够看出是datanode的namespaceID出错了。
所以最后shutDown了。
解决思路:
(1)先去hadoop路径下的配置文件hdfs-site.xml。看看:
[root@hadoop current]# vim /usr/local/hadoop1.1/conf/hdfs-site.xml
.....................................................................................................................................
<?xml version="1.0"?>
<?
<?
xml-stylesheet type="text/xsl" href="http://www.mamicode.com/configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
<property>
<name>dfs.name.dir</name>
<value>${hadoop.tmp.dir}/dfs/name</value>
<description>this is a comma-delimited list of directories
then the name table is replicated in all of the directories,
for redunancy.
</description>
</property>
</configuration>
.....................................................................................................................................
里面并没有有关datanode的配置信息。假设你有类似于以下的内容:
<property>
<name>dfs.data.dir</name>
<value>/data/hdfs/data</value>
</property>
<name>dfs.data.dir</name>
<value>/data/hdfs/data</value>
</property>
说明你的datanode配置文件不再默认路径,而是你自己设置过的路径下。
(2)进入datanode的 dfs.data.dir 的 current文件夹。改动里面的文件VERSION
因为我是默认的。所以路径是/usr/local/hadoop/tmp/dfs/data/current/VERSION。
这个版本号不同,可能路径也不同,最好自己去找找。
[root@hadoop current]# vim /usr/local/hadoop/tmp/dfs/data/current/VERSION
.....................................................................................................................................
#Thu Oct 30 04:52:01 PDT 2014
namespaceID=463031076
storageID=DS-1787154912-192.168.0.100-50010-1413940826285
cTime=0
storageType=DATA_NODE
layoutVersion=-32
namespaceID=463031076
storageID=DS-1787154912-192.168.0.100-50010-1413940826285
cTime=0
storageType=DATA_NODE
layoutVersion=-32
.....................................................................................................................................
看里面的namespaceID=463031076,能够发现。跟hadoop-root-datanode-hadoop.log中的datanode namespaceID = 463031076的一样,这说明他是读取这个文件的,所以我们没有找错。
(3)改动这个版本号信息文件VERSION
ID与hadoop-root-datanode-hadoop.log中 namenode namespaceID = 942590743一致
ps:我想大家应该能够想到namenode namespaceID是从哪里来的:
[root@hadoop current]# vim /usr/local/hadoop/tmp/dfs/name/current/VERSION
.....................................................................................................................................
#Fri Oct 31 19:23:44 PDT 2014
namespaceID=942590743
cTime=0
storageType=NAME_NODE
layoutVersion=-32
namespaceID=942590743
cTime=0
storageType=NAME_NODE
layoutVersion=-32
.....................................................................................................................................
这里的ID是不是与hadoop-root-datanode-hadoop.log中 namenode namespaceID = 942590743一致?
(4)改动完以后,又一次执行datanode
[root@hadoop current]# hadoop-daemon.sh start datanode
[root@hadoop current]# jps
8581 DataNode
看到DataNode,说明已经跑起来了。
datanode启动失败
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。