Answer the question
In order to leave comments, you need to log in
How to connect to hdfs via java?
There is an ambari cluster on which hdfs is installed. Ambari cluster installed via VirtualBox.
I try to connect to hdfs like this, but it gives a connection error.
Configuration configuration = new Configuration();
Path p=new Path("hdfs://127.0.0.1:8080/file.txt");
FileSystem fs = FileSystem.get(new URI("hdfs://127.0.0.1:8080"), configuration);
System.out.println(p.getName() + " exists: " + fs.exists(p));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question