How do you retrieve the replication factor info in Hdfs files?

brain storm picture brain storm · Aug 6, 2014 · Viewed 12.4k times · Source

I have set the replication factor for my file as follows:

hadoop fs -D dfs.replication=5 -copyFromLocal file.txt /user/xxxx

When a NameNode restarts, it makes sure under-replicated blocks are replicated. Hence the replication info for the file is stored (possibly in nameNode). How can I get that information?

Answer

Aleksei Shestakov picture Aleksei Shestakov · Aug 6, 2014

Try to use command hadoop fs -stat %r /path/to/file, it should print the replication factor.