Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

How can one increase replication factor to a desired value in Hadoop?


In hadoop how one can increase replication factor to a desired value?


Rising Star

The replication factor is a property that can be set in the HDFS configuration file( hdfs-site.xml).This will be to set global replication factor for the entire cluster.This will only work on the newly created files but not on the existing files. The Replication factor default value is 3, however for cluster in Pseudo distributed mode its 1.The replication factor value is configurable in hdfs-site.xml file.You have to change dfs.replication to a desired value.

This file is usually found in the conf folder of the Hadoop installation directory.
<value>(desired value)</value>

Change the replication factor on a per-file basis :
hadoop fs –setrep –w 3 /file/filename.xml

-setrep commnad to change the replication factor for files that already exist in HDFS.-R flag would recursively change the replication factor on all the files

hadoop fs –setrep –w 3 -R /directory/dir.xml


Do I need to put the namenode in safe mode to execute this command? or I can execute this on live cluster?


hadoop fs –setrep –w 3 -R /