Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

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

New Contributor

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

1 REPLY 1
Highlighted

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

New Contributor

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