无法在hadoop集群中创建默认datanode

xoshrz7s  于 2021-06-04  发布在  Hadoop
关注(0)|答案(2)|浏览(264)

我正在使用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

然后我用

~-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

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

r7xajy2e

r7xajy2e1#

拉维是对的。但是还要确保${dfs.data.dir}/current/version和${dfs.name.dir}/current/version中的集群id都匹配。如果不是,请将数据节点的群集id更改为与namenode相同。在做出更改之后,请遵循拉维提到的步骤。

ia2d9nvy

ia2d9nvy2#

每次格式化hdfs时,namenode都会生成新的namespaceid。datanodes通过namespaceid将自己绑定到namenode。
请按照以下步骤解决问题
a) 停止有问题的数据节点。b) 编辑${dfs.data.dir}/current/version中namespaceid的值,以匹配${dfs.name.dir}/current/version中当前namenode的相应值。c) 重新启动datanode。

相关问题