Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URI to access a file in HDFS

Tags:

hdfs

ambari

I have setup a cluster using Ambari that includes 3 nodes .

Now I want to access a file in a HDFS using my client application.

I can find all node URIs under Data Nodes in Amabari.

What is the URI + Port I need to use to access a file ? I have used the default installation process.

like image 656
nish1013 Avatar asked Dec 21 '15 10:12

nish1013


1 Answers

Default port is "8020".

You can access the "hdfs" paths in 3 different ways.

  1. Simply use "/" as the root path

    For e.g.

    E:\HadoopTests\target>hadoop fs -ls /
    Found 6 items
    drwxrwxrwt   - hadoop  hdfs          0 2015-08-17 18:43 /app-logs
    drwxr-xr-x   - mballur hdfs          0 2015-11-24 15:36 /tmp
    drwxrwxr-x   - mballur hdfs          0 2015-10-20 15:27 /user
    
  2. Use "hdfs:///"

    For e.g.

    E:\HadoopTests\target>hadoop fs -ls hdfs:///
    Found 6 items
    drwxrwxrwt   - hadoop  hdfs          0 2015-08-17 18:43 hdfs:///app-logs
    drwxr-xr-x   - mballur hdfs          0 2015-11-24 15:36 hdfs:///tmp
    drwxrwxr-x   - mballur hdfs          0 2015-10-20 15:27 hdfs:///user
    
  3. Use "hdfs://{NameNodeHost}:8020/"

    For e.g.

    E:\HadoopTests\target>hadoop fs -ls hdfs://MBALLUR:8020/
    Found 6 items
    drwxrwxrwt   - hadoop  hdfs          0 2015-08-17 18:43 hdfs://MBALLUR:8020/app-logs
    drwxr-xr-x   - mballur hdfs          0 2015-11-24 15:36 hdfs://MBALLUR:8020/tmp
    drwxrwxr-x   - mballur hdfs          0 2015-10-20 15:27 hdfs://MBALLUR:8020/user
    

    In this case, "MBALLUR" is the name of my Name Node host.

like image 122
Manjunath Ballur Avatar answered Oct 19 '22 20:10

Manjunath Ballur