HOWTO: Change replication factor of existing files in HDFS

December 23, 2008

There are references around the web regarding changing the replication factor on a running Hadoop system. For example, if you don’t have even distribution of blocks across your Datanodes, you can increase replication temporarily and then bring it back down.

To set replication of an individual file to 4:

./bin/hadoop dfs -setrep -w 4 /path/to/file

You can also do this recursively. To change replication of entire HDFS to 1:

./bin/hadoop dfs -setrep -R -w 1 /

Advertisements

One Response to “HOWTO: Change replication factor of existing files in HDFS”


  1. […] HOWTO: Change replication factor of existing files in HDFS […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: