hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lance Norskog <goks...@gmail.com>
Subject Re: add a resource (wich is in hdfs) to a configuration
Date Wed, 27 Oct 2010 06:46:10 GMT
Yes, I use this in a batch job driver. There is a common file with
global configs, and then a per-job config. The driver command line is:

driver -c common-site.xml batchjob.xml

On Tue, Oct 26, 2010 at 11:40 AM, Marc Sturlese <marc.sturlese@gmail.com> wrote:
>
> Thanks, it worked. In case it can help someone else:
>
>     try {
>        Configuration c = new Configuration() ;
>        FileSystem fs = FileSystem.get(c) ;
>        InputStream is = new FSDataInputStream(fs.open(new
> Path("hdfs://hadoop_cluster/user/me/conf/extra-props.xml"))) ;
>        c.addResource(is);
>        fs.getConf().reloadConfiguration();
>        System.out.println("Loaded prop: " +
> fs.getConf().get("my_custom_prop_A")) ;
>    }catch(Exception e) {
>          e.printStackTrace();
>    }
>
> The out will be the value of my_custom_prop_A property.
> It actually work aswell without reloading the configuration
> --
> View this message in context: http://lucene.472066.n3.nabble.com/add-a-resource-which-is-in-hdfs-to-a-configuration-tp1775238p1775854.html
> Sent from the Hadoop lucene-users mailing list archive at Nabble.com.
>



-- 
Lance Norskog
goksron@gmail.com

Mime
View raw message