Opening a HDFS file in browser

15,611

In HDFS 8020 is IPC port, you need to open HDFS Web UI for HDFS browser, It's default port is 50070, Open following URL from your Web Browser

http://localhost:50070/ , then Go to Live nodes option -> Select one of your datanodes from there -> Click on Browse filesystem

Share:
15,611
user182944
Author by

user182944

Updated on August 29, 2022

Comments

  • user182944
    user182944 over 1 year

    I am trying to open a file (present in the HDFS location: /user/input/Summary.txt) in my browser using the URL: hdfs://localhost:8020/user/input/Summary.txt but I am getting an error in my firefox browser:

    Firefox doesn't know how to open this address, because the protocol (hdfs) isn't associated with any program.

    If I change the protocol from hdfs to http (which ideally should not work) then I am getting the message: It looks like you are making an HTTP request to a Hadoop IPC port. This is not the correct port for the web interface on this daemon.

    This is present in the core-site.xml file:

    <property>
        <name>fs.default.name</name>
        <value>hdfs://localhost:8020</value>
      </property>
    

    Please let me know how to make this work. I am not sure whether the problem is related to firefox browser OR I am missing some configuration settings OR i am using the incorrect url.

    EDIT:

    When I try to access it from a java code, i get an exception: unknown protocol: hdfs.

    static{
        URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
    }
    
    public static void main(String[] args) throws MalformedURLException, IOException {
        final String url = "hdfs://localhost:8020/user/input/Summary.txt";
    
        InputStream is = new URL(url).openStream();
    
    }
    

    Please suggest how to access the hdfs protocol from java code.