2

I'm not asking how to set replication factor in hadoop for a folder/file. I know following command works flawlessly for existing files & folders.

hadoop fs -setrep -R -w 3 <folder-path>

I'm asking, how do I set the replication factor, other than default (which is 4 in my scenario), while copying data from local. I'm running following command,

hadoop fs -copyFromLocal <src> <dest>

When I run above commands, it copies the data from src to dest path with replication factor as 4. But I want to make replication factor as 1 while copying data but not after copying is complete. Bascially I want something like this,

hadoop fs -setrep -R 1 -copyFromLocal <src> <dest>

I tried it, but it didn't work. So, can it be done? or I've first copy data with replication factor 4 and then run setrep command?

vefthym
  • 7,422
  • 6
  • 32
  • 58
Abhishek
  • 6,912
  • 14
  • 59
  • 85

1 Answers1

5

According to this post and this post (both asking different questions), this command seems to work:

hadoop fs -D dfs.replication=1 -copyFromLocal <src> <dest>

The -D option means "Use value for given property."

Community
  • 1
  • 1
vefthym
  • 7,422
  • 6
  • 32
  • 58