You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Zhenhua Guo <je...@gmail.com> on 2010/12/22 09:40:31 UTC

Is it possible to specify different replication factors for different files?

I know there is a configuration parameter that can be used to specify
number of replicas.
I wonder whether I can specify different values for some files in my
program by using HDFS APIs.
Thanks

Gerald

Re: Is it possible to specify different replication factors for different files?

Posted by Zhenhua Guo <je...@gmail.com>.
Thanks!
I will try it.

Gerald

On Wed, Dec 22, 2010 at 12:26 PM, Harsh J <qw...@gmail.com> wrote:
> Hi,
>
> DFSClient.setReplication(pathStr, repFactor); will do it.
>
> http://hadoop.apache.org/hdfs/docs/r0.21.0/api/org/apache/hadoop/hdfs/DFSClient.html#setReplication(java.lang.String,
> short) is the API you're looking for.
>
> --
> Harsh J
> www.harshj.com
>

Re: Is it possible to specify different replication factors for different files?

Posted by Harsh J <qw...@gmail.com>.
Hi,

DFSClient.setReplication(pathStr, repFactor); will do it.

http://hadoop.apache.org/hdfs/docs/r0.21.0/api/org/apache/hadoop/hdfs/DFSClient.html#setReplication(java.lang.String,
short) is the API you're looking for.

-- 
Harsh J
www.harshj.com

Re: Is it possible to specify different replication factors for different files?

Posted by Brian Bockelman <bb...@cse.unl.edu>.
Replication level is a per-file setting (and it can be changed at any time), as long as it is within the namenode's minimum and maximum.  If none is set explicitly by the user, it will use the client's default.

Look through the Java API documents to see how to do this for the class you are using.

Brian

On Dec 22, 2010, at 2:40 AM, Zhenhua Guo wrote:

> I know there is a configuration parameter that can be used to specify
> number of replicas.
> I wonder whether I can specify different values for some files in my
> program by using HDFS APIs.
> Thanks
> 
> Gerald