恢复CDH之HDFS服务: 删除了VERSION文件

  • 需求说明: 由于服务器被攻击,hdfs集群的VERSION文件被删除,看似集群正常运行,但遇到修改配置,需要重启hdfs服务时,就会报错(namenode 未格式化)

1, 查看VERSION文件格式: namenode, datanode

文件路径 字段内容
dn/current/VERSION clusterID,storageType,layoutVersion, storageID, datanodeUuid
dn/current/BP-xx-NN节点IP-xx/current/VERSION namespaceID, cTime=0, blockpoolID,layoutVersion
nn/current/VERSION clusterID,storageType, 字段同上
[root@centos_server dfs]# cat dn/current/VERSION 
#Tue Nov 05 18:46:13 CST 2019
storageID=DS-8f11dac8-1585-40b9-979d-3028ffa241dd
clusterID=cluster13
cTime=0
datanodeUuid=907edbd1-7126-457e-890c-1e8550cb5b1c
storageType=DATA_NODE
layoutVersion=-56

# cat  dn/current/具体的blockpoolID-对应的目录/current/VERSION
[root@centos_server dfs]# cat dn/current/BP-782628945-服务器具体IP-1572928546988/current/VERSION 
#Tue Nov 05 18:46:13 CST 2019
namespaceID=495849129
cTime=0
blockpoolID=BP-782628945-服务器具体IP-1572928546988
layoutVersion=-56


[root@centos_server dfs]# cat nn/current/VERSION 
#Tue Nov 05 12:35:47 CST 2019
namespaceID=495849129
clusterID=cluster13
cTime=0
storageType=NAME_NODE
blockpoolID=BP-782628945-服务器具体IP-1572928546988
layoutVersion=-60

2, 修复VERSION文件: namenode, datanode

###============================ 日志结构: 滚动(DATANODE.out.数字/NAMENODE.out.数字)
[hbase@centos_server hadoop-hdfs]$ ls
hadoop-cmf-hdfs-DATANODE-centos_server.log.out           hdfs-audit.log     hdfs-audit.log.17  hdfs-audit.log.7
hadoop-cmf-hdfs-DATANODE-centos_server.log.out.1         hdfs-audit.log.1   hdfs-audit.log.18  hdfs-audit.log.8
hadoop-cmf-hdfs-DATANODE-centos_server.log.out.2         hdfs-audit.log.10  hdfs-audit.log.19  hdfs-audit.log.9
hadoop-cmf-hdfs-NAMENODE-centos_server.log.out           hdfs-audit.log.11  hdfs-audit.log.2   SecurityAuth-hdfs.audit
hadoop-cmf-hdfs-NAMENODE-centos_server.log.out.1         hdfs-audit.log.12  hdfs-audit.log.20  SecurityAuth-root.audit
hadoop-cmf-hdfs-NAMENODE-centos_server.log.out.2         hdfs-audit.log.13  hdfs-audit.log.3   SecurityAuth-yskj.audit
hadoop-cmf-hdfs-NAMENODE-centos_server.log.out.3         hdfs-audit.log.14  hdfs-audit.log.4   stacks
hadoop-cmf-hdfs-NAMENODE-centos_server.log.out.4         hdfs-audit.log.15  hdfs-audit.log.5
hadoop-cmf-hdfs-SECONDARYNAMENODE-centos_server.log.out  hdfs-audit.log.16  hdfs-audit.log.6

###=============================  DataNode节点日志 =============================
----------find storageID: storageID
[root@eadage hadoop-hdfs]# grep storageID  hadoop-cmf-hdfs-DATANODE-eadage.log.out
2019-11-05 12:44:08,920 INFO org.apache.hadoop.hdfs.server.common.Storage: Generated new storageID DS-8f11dac8-1585-40b9-979d-3028ffa241dd for directory /home/cdh/dfs/dn
2019-11-05 12:44:10,490 INFO org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl: Added new volume: DS-8f11dac8-1585-40b9-979d-3028ffa241dd

----------find blockpoolID: blockid
[hbase@eadage hadoop-hdfs]$ grep blockid hadoop-cmf-hdfs-DATANODE-eadage.log.out 
2019-11-08 15:26:02,567 INFO org.apache.hadoop.hdfs.server.datanode.DataNode.clienttrace: src: /NN节点具体IP:62657,
dest: /NN节点具体IP:50010, bytes: 521, op: HDFS_WRITE, cliID: DFSClient_NONMAPREDUCE_1622832045_1, offset: 0, 
srvID: 907edbd1-7126-457e-890c-1e8550cb5b1c, blockid: BP-782628945-NN节点具体IP-1572928546988:blk_1073767910_27086, duration: 1520832

----------find datanodeUuid: UUID
[root@eadage hadoop-hdfs]# grep UUID  hadoop-cmf-hdfs-DATANODE-eadage.log.out |more
2019-11-05 12:44:10,441 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Generated and persisted new Datanode UUID 907edbd1-7126-457e-890
c-1e8550cb5b1c
2019-11-05 12:44:10,539 INFO org.apache.hadoop.hdfs.server.datanode.DataNode: Block pool BP-782628945-NN节点具体IP-1572928546988 (Datanode Uu
id 907edbd1-7126-457e-890c-1e8550cb5b1c) service to eadage/NN节点具体IP:8022 beginning handshake with NN

###=============================  NameNode节点日志 =============================
----------find namespaceID: nsid ,  clusterID:cid ,   datanodeUuid:datanodeUuid
[hbase@eadage hadoop-hdfs]$ grep nsid  hadoop-cmf-hdfs-NAMENODE-eadage.log.out 
2019-11-06 22:48:11,345 INFO BlockStateChange: BLOCK* processReport 0x1cdb2e6a2337c49b: from storage DS-8f11dac8-1585-40b9-979d-3028ffa241dd node DatanodeRegistration(NN节点具体IP, 
datanodeUuid=907edbd1-7126-457e-890c-1e8550cb5b1c, infoPort=50075, infoSecurePort=0, ipcPort=50020, storageInfo=lv=-56;
cid=cluster13;nsid=495849129;c=0), 
blocks: 4956, hasStaleStorage: false, processing time: 6 msecs, invalidatedBlocks: 0
2019-11-07 04:48:12,279 INFO BlockStateChange: BLOCK* processReport 0x1cdb2e6a2337c49c: from storage DS-8f11dac8-1585-40b9-979d-3028ffa241dd node DatanodeRegistration(NN节点具体IP, 
datanodeUuid=907edbd1-7126-457e-890c-1e8550cb5b1c, infoPort=50075, infoSecurePort=0, ipcPort=50020, storageInfo=lv=-56;
cid=cluster13;nsid=495849129;c=0), 
blocks: 4957, hasStaleStorage: false, processing time: 3 msecs, invalidatedBlocks: 0
发布了276 篇原创文章 · 获赞 37 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/eyeofeagle/article/details/102973239
今日推荐