WebHosting

Wednesday, January 2, 2013

Changing Replication factor in hadoop on fly

Changing Replication factor in Hadoop on fly, the may be many time when you need to define replication factor of a specific file or directory on the fly, so following command will help you to change it.

The command used for this is "setrep"

How will you do it?

Solution :

Here are the steps :

Syntax :

  • hadoop dfs -setrep [-R] <path>
    So this will change the replication factor of a file, and the optional [R] will ask to change the replication factor recursively.
    This will return 0, and -1 on failure.

Some Examples of the commnad:
  •     hadoop dfs -setrep -w 2 /home/filename   <---- </home/filename is path of file on hdfs>
If you want to change recursively, of entire hdfs, or directory then you can user following command

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

This will change the replication recursively.

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

Warp AI Terminal 🔥 | The Future of Coding? Agentic Dev Environment Explained!

  Warp AI Terminal 🔥 | The Future of Coding? Agentic Dev Environment Explained! What if your terminal could think, assist, and even act li...