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 in Big Data Hadoop by nitinrawat895
• 10,800 points
91 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 by ravikiran
• 4,580 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 20, 2018 in Big Data Hadoop by Omkar
• 68,480 points
523 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,810 points
734 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
• 68,480 points
382 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,350 points
968 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,350 points
514 views
0 votes
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
• 10,800 points
3,575 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
18,427 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 in Big Data Hadoop by ravikiran
• 4,580 points
47 views
0 votes
1 answer