在浏览器中打开HDFS文件

use*_*944 3 firefox hadoop bigdata hdfs

我正在尝试使用以下URL在我的浏览器中打开一个文件(存在于HDFS位置:/user/input/Summary.txt):hdfs:// localhost:8020/user/input/Summary.txt但是我得到了一个我的firefox浏览器出错:

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

如果我将协议更改hdfshttp(理想情况下不应该工作),那么我收到消息: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.

这出现在core-site.xml文件中:

<property>
    <name>fs.default.name</name>
    <value>hdfs://localhost:8020</value>
  </property>
Run Code Online (Sandbox Code Playgroud)

请让我知道如何使这项工作.我不确定问题是否与firefox浏览器有关或我错过了一些配置设置或我使用的是不正确的URL.

编辑:

当我尝试从java代码访问它时,我得到一个例外: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();

}
Run Code Online (Sandbox Code Playgroud)

请建议如何访问hdfs protocoljava代码.

Sac*_*inJ 5

在HDFS 8020是IPC端口,你需要为HDFS浏览器打开HDFS Web UI,它的默认端口是50070,从你的Web浏览器打开以下URL

http://localhost:50070/,然后转到Live nodes选项 - >从那里选择一个数据节点 - >单击浏览文件系统

  • 在 hadoop 版本 &gt;3.0.0 中,端口更改为 9870 (3认同)