Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 911
brain storm Avatar asked Aug 06 '14 17:08

brain storm


2 Answers

In case if you need to check replication factor of a HDFS directory

hdfs fsck /tmp/data

shows the average replication factor of /tm/data/ HDFS folder enter image description here

like image 111
Manju N Avatar answered Nov 06 '22 01:11

Manju N


You can run following command to get replication factor,

hadoop fs -ls /user/xxxx

The second column in the output signify replication factor for the file and for the folder it shows -, as shown in below pic.

enter image description here

like image 28
Abhishek Avatar answered Nov 06 '22 01:11

Abhishek