1

我正在使用 Ubuntu 10.04。我在本地目录中安装了 hadoop 作为独立目录。

~-desktop:~$ hadoop/bin/hadoop version
Hadoop 1.2.0
Subversion https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1479473
Compiled by hortonfo on Mon May  6 06:59:37 UTC 2013
From source with checksum 2e0dac51ede113c1f2ca8e7d82fb3405
This command was run using /home/circar/hadoop/hadoop-core-1.2.0.jar

conf/core-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>

<property>
  <name>hadoop.tmp.dir</name>
  <value>/home/circar/hadoop/dataFiles</value>
  <description>A base for other temporary directories.</description>
</property>

<property>
  <name>fs.default.name</name>
  <value>hdfs://localhost:54310</value>
  <description>The name of the default file system.  A URI whose
  scheme and authority determine the FileSystem implementation.  The
  uri's scheme determines the config property (fs.SCHEME.impl) naming
  the FileSystem implementation class.  The uri's authority is used to
  determine the host, port, etc. for a filesystem.</description>
</property>

</configuration>

mapred-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>

<property>
  <name>mapred.job.tracker</name>
  <value>localhost:54311</value>
  <description>The host and port that the MapReduce job tracker runs
  at.  If "local", then jobs are run in-process as a single map
  and reduce task.
  </description>
</property>

</configuration>

hdfs-site.xml

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>

<property>
  <name>dfs.replication</name>
  <value>1</value>
  <description>Default block replication.
  The actual number of replications can be specified when the file is created.
  The default is used if replication is not specified in create time.
  </description>
</property>

</configuration>

我已经格式化了两次namenode

~-desktop:~$ hadoop/bin/hadoop namenode -format

然后我开始使用hadoop

~-desktop:~$ hadoop/bin/start-all.sh

显示结果为:

starting namenode, logging to /home/circar/hadoop/libexec/../logs/hadoop-circar-namenode-circar-desktop.out
circar@localhost's password: 
localhost: starting datanode, logging to /home/circar/hadoop/libexec/../logs/hadoop-circar-datanode-circar-desktop.out
 circar@localhost's password: 
 localhost: starting secondarynamenode, logging to /home/circar/hadoop/libexec/../logs/hadoop-circar-secondarynamenode-circar-desktop.out
 starting jobtracker, logging to /home/circar/hadoop/libexec/../logs/hadoop-circar-jobtracker-circar-desktop.out
 circar@localhost's password: 
 localhost: starting tasktracker, logging to /home/circar/hadoop/libexec/../logs/hadoop-circar-tasktracker-circar-desktop.out

但是在 /logs/hadoop-circar-datanode-circar-desktop.log

它显示错误为:

2013-06-24 17:32:47,183 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting DataNode
STARTUP_MSG:   host = circar-desktop/127.0.1.1
STARTUP_MSG:   args = []
STARTUP_MSG:   version = 1.2.0
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1479473; compiled by 'hortonfo' on Mon May  6 06:59:37 UTC 2013
STARTUP_MSG:   java = 1.6.0_26
************************************************************/
2013-06-24 17:32:47,315 INFO org.apache.hadoop.metrics2.impl.MetricsConfig: loaded properties from hadoop-metrics2.properties
2013-06-24 17:32:47,324 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source MetricsSystem,sub=Stats registered.
2013-06-24 17:32:47,325 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Scheduled snapshot period at 10 second(s).
2013-06-24 17:32:47,325 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: DataNode metrics system started
2013-06-24 17:32:47,447 INFO org.apache.hadoop.metrics2.impl.MetricsSourceAdapter: MBean for source ugi registered.
2013-06-24 17:32:47,450 WARN org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Source name ugi already exists!
2013-06-24 17:32:49,265 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs in /home/circar/hadoop/dataFiles/dfs/data: namenode namespaceID = 186782509; datanode namespaceID = 1733977738
    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:412)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:319)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1698)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1637)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1655)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.secureMain(DataNode.java:1781)
    at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1798)

2013-06-24 17:32:49,266 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at circar-desktop/127.0.1.1
************************************************************/

JPS 显示:

 ~-desktop:~$ jps
 8084 Jps
 7458 JobTracker
 7369 SecondaryNameNode
 7642 TaskTracker
 6971 NameNode

当我试图停止它时,它显示:

~-desktop:~$ hadoop/bin/stop-all.sh 
stopping jobtracker
circar@localhost's password: 
localhost: stopping tasktracker
stopping namenode
circar@localhost's password: 
localhost: *no datanode to stop*
circar@localhost's password: 
localhost: stopping secondarynamenode

我在做什么错?有人帮我吗?

4

2 回答 2

2

拉维是正确的。但还要确保 ${dfs.data.dir}/current/VERSION 和 ${dfs.name.dir}/current/VERSION 中的 cluster_id 匹配。如果不更改数据节点的 cluster_id 与 namenode 相同。进行更改后,请按照 Ravi 提到的步骤进行操作。

于 2013-10-25T00:04:14.333 回答
1

每次格式化 HDFS 时,Namenode 都会生成新的 namespaceID。Datanodes 通过 namespaceID 将自己绑定到 namenode。

请按照以下步骤解决问题

a) 停止有问题的 DataNode。b) 编辑 ${dfs.data.dir}/current/VERSION 中 namespaceID 的值,以匹配 ${dfs.name.dir}/current/VERSION 中当前 NameNode 的对应值。c) 重启数据节点。

于 2013-06-24T14:29:26.407 回答