在浏览器中打开 HDFS 文件

Opening a HDFS file in browser

我正在尝试使用 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.

如果我将协议从 hdfs 更改为 http(理想情况下应该不起作用),那么我会收到消息: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>

请告诉我如何进行这项工作。我不确定问题是否与 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();

}

请建议如何从 java 代码访问 hdfs protocol

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

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