You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-user@hadoop.apache.org by Pedro Costa <ps...@gmail.com> on 2012/01/11 12:52:59 UTC

How can I know in which datanodes a file is replicated in HDFS?

Hi,

How can I know in which datanodes a file is replicated in HDFS? Is there a
command for that?

-- 
Thanks,

Re: How can I know in which datanodes a file is replicated in HDFS?

Posted by Harsh J <ha...@cloudera.com>.
This has been asked before: http://search-hadoop.com/m/wlDYNqCla81

One (hacky) command is "hadoop fsck /path/to/file -files -blocks -locations".

You should rather write your own command with
http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/fs/FileSystem.html#getFileBlockLocations(org.apache.hadoop.fs.FileStatus,
long, long) so that its lighter and more direct.

On Wed, Jan 11, 2012 at 5:22 PM, Pedro Costa <ps...@gmail.com> wrote:
> Hi,
>
> How can I know in which datanodes a file is replicated in HDFS? Is there a
> command for that?
>
> --
> Thanks,
>



-- 
Harsh J