1.问题
执行start-dfs.sh后在进程中查看jps,发现NameNode启动,但DataNode没有
2.原因
在失败的.log文件中看到datanode的clusterID 和 namenode的clusterID 不一致
原因可能是多次Hadoop namenode -format导致clusterID不一致
3.解决方法
1)先去hadoop路径下的配置文件hdfs-site.xml可知dfs.namenode.name.dir的地址和dfs.datanode.data.dir的地址
默认:file://${hadoop.tmp.dir}/dfs/name、file://${hadoop.tmp.dir}/dfs/data
2)在.../name/current/VERSION 中获得clusterID
[[email protected] current]# more VERSION #Mon Sep 02 18:06:26 CST 2019 namespaceID=1033971221 clusterID=CID-98e754ef-ad92-49f8-88b2-6830888f2d48 cTime=0 storageType=NAME_NODE blockpoolID=BP-1400239548-192.168.1.201-1567418785939 layoutVersion=-63
3)将clusterID修改到.../dfs/data/current/VERSION
[[email protected] current]# vi VERSION #Sun Sep 01 19:46:01 CST 2019 storageID=DS-330d79ed-7c1b-4d40-b151-81ffcadcf9f0 #clusterID=CID-ae479da3-0b1e-44b0-a383-029a213b3481 clusterID=CID-98e754ef-ad92-49f8-88b2-6830888f2d48 cTime=0 datanodeUuid=67fcc2ae-1b74-46cd-90df-336a0b1950e6 storageType=DATA_NODE layoutVersion=-56
4)再次启动DataNode,成功启动
[[email protected] hadoop-2.7.2]# sbin/hadoop-daemon.sh start datanode starting datanode, logging to /opt/module/hadoop-2.7.2/logs/hadoop-root-datanode-hadoop201.com.out [[email protected] hadoop-2.7.2]# jps 11525 DataNode 10809 QuorumPeerMain 11001 NameNode 11598 Jps
原文地址:https://www.cnblogs.com/MWCloud/p/11448138.html
时间: 2024-11-09 10:48:31