Explain to me how to get Hadoop configuration in Java Util

0 votes

I am programming a Java Utility which requires to access HDFS for that I needed a configuration object. I created one using the following method.

Configuration conf = new Configuration()

it doesn't seem to find the DFS, and just uses the local file system; printing

fs.getHomeDirectory()

I've tried adding core-site.xml,mapred-site.xml,yarn-site.xml, and HDFS-site.xml to the Configuration as resources. Nothing seems to work out. Please help me out on this one.

May 24, 2019 in Big Data Hadoop by nitinrawat895
• 11,380 points
2,230 views

1 answer to this question.

0 votes

In order to get access to the File system you are expected to use the following configuration and a file system:

  1. Get the instance of Configuration
  2. Get the HDFS instance

#Configuration configuration = new Configuration();
#FileSystem hdfs = FileSystem.get(new URI("hdfs://"+HadoopLocation+":8020"), configuration);

In Your case, The HadoopLocation is the location in which you have your hadoop server (Possibly Localhost)

answered May 24, 2019 by ravikiran
• 4,620 points

Related Questions In Big Data Hadoop

0 votes
11 answers
0 votes
1 answer

Hadoop: How to get the column name along with the output in Hive?

You can get the column names by ...READ MORE

answered Nov 21, 2018 in Big Data Hadoop by Omkar
• 69,220 points
4,929 views
0 votes
1 answer

How to get absolute path of files in a directory in Hadoop?

You can use HDFS API like the ...READ MORE

answered Dec 4, 2018 in Big Data Hadoop by Frankie
• 9,830 points
4,619 views
0 votes
1 answer

How to run Java file in Hadoop?

Try this: hadoop fs -cat hdfs:///user/hadoop/values.txt READ MORE

answered Dec 12, 2018 in Big Data Hadoop by Omkar
• 69,220 points
3,965 views
0 votes
1 answer

Moving files in Hadoop using the Java API?

I would recommend you to use FileSystem.rename(). ...READ MORE

answered Apr 15, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,704 views
0 votes
1 answer

Hadoop giving java.io.IOException, in mkdir Java code.

I am not sure about the issue. ...READ MORE

answered May 3, 2018 in Big Data Hadoop by Shubham
• 13,490 points
2,586 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
11,108 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,240 views
0 votes
1 answer

Explain to me the Elasticsearch and Hadoop in a much better manner

I understand your problem, I suggest you download ...READ MORE

answered May 10, 2019 in Big Data Hadoop by ravikiran
• 4,620 points
677 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP