当我动态添加一个Hadoop从节点的之后,出现了一个问题:
[root@hadoop current]# hadoop-daemon.sh start datanode
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
************************************************************/
读日志文件:
先看到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="https://www.linuxidc.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的配置信息,如果你有类似于下面的内容: