Support Questions

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

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

avatar
Contributor

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

2 REPLIES 2

avatar
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.
<property>
<name>dfs.replication</name>
<value>(desired value)</value>
</property>

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

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

avatar
Explorer

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 /