hdfs namenode和datanode无法基于dfs.replication值启动

时间:2018-08-23 07:47:56

标签: java hadoop hdfs yarn

由于我正处于Hadoop的学习阶段,因此Hadoop单一集群设置存在问题。我正在使用Hadoop 2.9.0和Java8。我已经完成了设置,如下所示

core-site.xml

<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/ubuntu/hadooptmp/hadoop-${user.name}</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>

mapred-site.xml

<configuration>
   <property>
      <name>mapreduce.framework.name</name>
      <value>localhost:9001</value>
   </property>
</configuration>

yarn-site.xml

<configuration>
<!-- Site specific YARN configuration properties -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>

hdfs-site.xml

<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property><name>dfs.name.dir</name>
<value>file:///home/ubuntu/hadoop/hdfs/namenode</value>
<final>true</final>
</property>
<property>
<name>dfs.data.dir</name>
<value>file:///home/ubuntu/hadoop/hdfs/datanode</value>
<final>true</final>
</property>
</configuration>

现在hdfs-site.xml中dfs.replication的值为1。现在我正在执行start-all.sh,如果我检查状态-

7536 ResourceManager
7025 NameNode
7378 SecondaryNameNode
8147 Jps
7667 NodeManager

现在我有了stop-all.sh,如果我将hdfs-site.xml中的dfs.replication的值更改为0(某些人将其称为解决方案),然后再次启动all.sh。状态为-

9024 DataNode
9362 ResourceManager
9493 NodeManager
9815 Jps

我们可以看到Name节点在这种情况下停止运行。我曾尝试格式化两者,但没有解决。我无法理解我无法同时运行Namenode和datanode的设置错误。

我已经在aws ubuntu服务器上完成了所有单个群集设置。我尝试将mapred-site.xml中的mapreduce.framework.name值设置为“ yarn”,但没有帮助。 请让我知道是否有解决方案。

在下面添加了Datanode日志

2018-08-23 15:08:14,494 INFO org.apache.hadoop.hdfs.server.common.Storage: Using 1 threads to upgrade data directories (dfs.datanode.parallel.volumes.load.threads.num=1, dataDirs=1)
2018-08-23 15:08:14,506 INFO org.apache.hadoop.hdfs.server.common.Storage: Lock on /home/ubuntu/hadoop/hdfs/datanode/in_use.lock acquired by nodename 1827@ip-172-31-29-76.us-east-2.compute.internal
2018-08-23 15:08:14,509 WARN org.apache.hadoop.hdfs.server.common.Storage: Failed to add storage directory [DISK]file:/home/ubuntu/hadoop/hdfs/datanode/
java.io.IOException: Incompatible clusterIDs in /home/ubuntu/hadoop/hdfs/datanode: namenode clusterID = CID-e5d9317d-7c4d-40eb-8fa2-030c5a8cfad6; datanode clusterID = CID-f416763a-ed6f-41d7-8b9d-12c298c5d779
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:760)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.loadStorageDirectory(DataStorage.java:293)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.loadDataStorage(DataStorage.java:409)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.addStorageLocations(DataStorage.java:388)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:556)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:1649)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:1610)
        at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:374)
        at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:280)
        at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:816)
        at java.lang.Thread.run(Thread.java:748)
2018-08-23 15:08:14,516 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: Initialization failed for Block pool <registering> (Datanode Uuid 85d94537-7ccc-4d7d-aa2c-48c65a453399) service to localhost/127.0.0.1:9000. Exiting.
java.io.IOException: All specified directories have failed to load.
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:557)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.initStorage(DataNode.java:1649)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.initBlockPool(DataNode.java:1610)
        at org.apache.hadoop.hdfs.server.datanode.BPOfferService.verifyAndSetNamespaceInfo(BPOfferService.java:374)
        at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.connectToNNAndHandshake(BPServiceActor.java:280)
        at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:816)
        at java.lang.Thread.run(Thread.java:748)
2018-08-23 15:08:14,516 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Ending block pool service for: Block pool <registering> (Datanode Uuid 85d94537-7ccc-4d7d-aa2c-48c65a453399) service to localhost/127.0.0.1:9000
2018-08-23 15:08:14,518 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Removed Block pool <registering> (Datanode Uuid 85d94537-7ccc-4d7d-aa2c-48c65a453399)
2018-08-23 15:08:16,520 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Exiting Datanode
2018-08-23 15:08:16,531 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: SHUTDOWN_MSG:
/************************************************************
SHUTDOWN_MSG: Shutting down DataNode at ip-172-31-29-76.us-east-2.compute.internal/172.31.29.76

1 个答案:

答案 0 :(得分:0)

我认为问题是名称节点的ClusterID与数据节点之间的冲突。我运行了一个命令“ sudo rm -rf / home / ubuntu / hadoop / hdfs / datanode / * ”,该问题现在已解决,即Namenode和Datanode都在运行。

4632 NameNode
4793 DataNode
5145 ResourceManager
5531 Jps
5276 NodeManager
4989 SecondaryNameNode

感谢您的帮助。让我知道我是否错过任何事情。