10 / 12
HDFS - Hands-On - More Commands

To access the files in HDFS, we can type any of the commands displayed on the screen.

To see which datanodes have blocks of sample.txt, use the following command:

hdfs fsck -blocks -locations -racks -files sample.txt

Blocks are located on datanodes having private ips, and

By default, Every file is having a replication factor of 3 on CloudxLab. To change the replication factor of sample.txt to 1, we can run

hadoop fs -setrep -w 1 /user/abhinav9884/sample.txt

Now if we check the blocks, we will see that the Average block replication is 1. If you want to increase your space quota on HDFS, please decrease the replication factor of your home directory in HDFS

Lab Details

Enroll now to learn and practice or Refer friends and get 15 days lab access

Enroll Now >>