简体   繁体   English

HDFS如何删除块?

[英]How HDFS delete the block?

I am new to Hadoop. 我是Hadoop的新手。

After my deployment, I ran the benchmark, $hadoop jar hadoop-0.20.0-test.jar TestDFSIO -write -nrFiles 1000 -fileSize 10. 部署之后,我运行了基准测试, $ hadoop jar hadoop-0.20.0-test.jar TestDFSIO -write -nrFiles 1000 -fileSize 10。

After the work done, I looked at the Cluster Summary, Say 1000 files and directories, 1000 blocks = 2000 total. 完成工作后,我查看了Cluster Summary,Say 1000个文件和目录,1000个块= 2000个。

Then I use the shell cmd to delete the corresponding files. 然后我使用shell cmd删除相应的文件。 Then the Cluster Summary is: 0 files and directories 1000 blocks = 1000 total. 然后群集摘要是:0个文件和目录1000个块=总共1000个。

I think after the deletion there should be no files and no blocks in the Cluster Summary. 我认为删除后,群集摘要中应该没有文件和块。 But the actual situation are: Before I ask this question is 1000 blocks. 但实际情况是:在我问这个问题之前是1000块。 But now there're 0 blocks. 但现在有0个街区。

How can this happen? 怎么会发生这种情况?

Delete is just instructing the NameNode to remove the file from its metadata store. 删除只是指示NameNode从其元数据存储中删除该文件。 After this has been committed, the NameNode will then reach out to the Datanodes which host the blocks and instruct them to delete the blocks. 在提交之后,NameNode将转到托管块的Datanodes,并指示它们删除块。

The actual file deletion on the data nodes could take a few seconds (depending on the number of datanodes, block size and number of blocks to delete), and then the data nodes will report back to the nameNode, at which point it will update the global number of blocks. 数据节点上的实际文件删除可能需要几秒钟(取决于数据节点的数量,块大小和要删除的块数),然后数据节点将报告回nameNode,此时它将更新全局块数。 As you observed, after a few moments, the total number of blocks will be back to 0 正如您所观察到的,片刻之后,总块数将回到0

块删除操作异步完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM