FAQ
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

Search Discussions

  • Brian Bockelman at Dec 22, 2010 at 1:21 pm
    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
  • Harsh J at Dec 22, 2010 at 5:27 pm
    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
  • Zhenhua Guo at Dec 23, 2010 at 4:33 pm
    Thanks!
    I will try it.

    Gerald
    On Wed, Dec 22, 2010 at 12:26 PM, Harsh J 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-user @
categorieshadoop
postedDec 22, '10 at 8:41a
activeDec 23, '10 at 4:33p
posts4
users3
websitehadoop.apache.org...
irc#hadoop

People

Translate

site design / logo © 2022 Grokbase