我正在尝试使用以下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
。
答案 0 :(得分:5)
在HDFS 8020是IPC端口,您需要为HDFS浏览器打开HDFS Web UI,它的默认端口是50070,从Web浏览器打开以下URL
http://localhost:50070/
,然后转到Live nodes
选项 - &gt;从那里选择一个数据节点 - &gt;单击Browse filesystem