Saturday 2 January 2016

Hadoop: setrep: Change replication factor of a file

“setrep” command is used to change replication factor of a file.

Usage:
hadoop fs [generic options] -setrep [-R] [-w] <rep> <path> ...

Options:
The -w flag requests that the command wait for the replication to complete. This usually takes very long time.
The -R flag is accepted for backwards compatibility. It has no effect.

If path is a directory then the command recursively changes the replication factor of all files under the directory tree rooted at path.

How to get replication factor of a file
By using “ls” command you can get the replication factor of a file.

$ hadoop fs -ls /user/harikrishna_gurram/dir1
Found 2 items
-rw-rw-r--   5 Phalgun            group1             20 2015-06-18 12:45 /user/harikrishna_gurram/dir1/append.txt
-rw-r--r--   5 harikrishna_gurram supergroup        468 2015-06-18 12:45 /user/harikrishna_gurram/dir1/sample.txt


The second column of the output shows the replication factor of the file.


Previous                                                 Next                                                 Home

No comments:

Post a Comment