Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
MapReduce >> mail # user >> Question on adding Hadoop XML to Configuration Object


+
Chandra Mohan, Ananda Vel... 2012-08-09, 07:07
Copy link to this message
-
Re: Question on adding Hadoop XML to Configuration Object
Hello there,

        Add the "conf/core-site.xml" file as well.

Regards,
    Mohammad Tariq
On Thu, Aug 9, 2012 at 12:37 PM, Chandra Mohan, Ananda Vel Murugan
<[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> I am trying to add a file to HDFS programmatically.
>
>
>
> In my code, I am adding hdfs-site.xml and other xml to Hadoop Configuration
> object as follows
>
>
>
> Configuration configuration = null;
>
> configuration.addResource(new
> URL("file:///usr/local/hadoop-1.0.2/conf/hdfs-site.xml"));
>
> configuration.addResource(new
> Path("usr/local/hadoop-1.0.2/conf/hdfs-site.xml"));
>
> configuration.reloadConfiguration();
>
> fileSystem = FileSystem.get(configuration);
>
> System.out.println(fileSystem.getName());
>
>
>
> This code prints file system as file:/// instead of hdfs://.
>
>
>
> When I manually set HDFS configuration parameter like below, it works well
>
>
>
> //configuration.set("fs.default.name", "hdfs://10.78.32.252:54310");
>
>
>
> How can I make my code work? Any inputs would be greatly appreciated.
>
>
>
> Regards,
>
> Anand.C
>
>
>
>
+
Chandra Mohan, Ananda Vel... 2012-08-09, 08:28
+
Mohammad Tariq 2012-08-09, 08:32
+
Dave Beech 2012-08-09, 08:34
+
Mohammad Tariq 2012-08-09, 08:34
+
Chandra Mohan, Ananda Vel... 2012-08-09, 08:42
+
Dave Beech 2012-08-09, 08:32
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB