How to track which data block is in which data node in hadoop?

Varshith picture Varshith · Jun 16, 2011 · Viewed 23.6k times · Source

If a data block is replicated, in which data node will it be replicated to? Is there any tool to show where the replicated blocks are present?

Answer

user188041 picture user188041 · Jun 16, 2011

If you know the filename, you can look this up through the DFS browser.

Go to your namenode web interface, say "browse the filesystem" and navigate to the file you're interested in. In the bottom of the page, there will be a list of all blocks in the file, and where each of those blocks is located.

NOTE: It looks like this when you click on an actual file within the HDFS filesystem.

ss#1

Alternatively, you could run:

hadoop fsck / -files -blocks -locations

Which will report on all blocks and all their locations.