hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chandra Mohan, Ananda Vel Murugan" <Ananda.Muru...@honeywell.com>
Subject Question on adding Hadoop XML to Configuration Object
Date Thu, 09 Aug 2012 07:07:44 GMT
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



Mime
View raw message