问题描述
我试图在浏览器中使用URL:hdfs:// localhost:8020 / user / input / Summary.txt打开一个文件(位于HDFS位置:/user/input/Summary.txt),但是我在我的firefox浏览器中出现错误:
$ b $ Firefox不知道如何打开这个地址,因为协议(hdfs)不是如果我将协议从
hdfs
更改为<$ c $ c> http
(理想情况下不应该工作),那么我得到的消息:看起来您正在向Hadoop IPC端口发出HTTP请求。这不是此守护程序上Web界面的正确端口。
这存在于 core-site.xml
文件中:
<属性>
<名称> fs.default.name< /名称>
< value> hdfs:// localhost:8020< /值>
< / property>
请让我知道如何使这项工作。我不确定这个问题是否与Firefox浏览器有关,或者我缺少一些配置设置,或者我使用的是不正确的URL。
编辑:
当我尝试从java代码访问它时,出现一个异常:未知协议:hdfs
。
static {
URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
}
public static void main(String [] args)抛出MalformedURLException,IOException {
final String url =hdfs:// localhost:8020 / user / input / Summary 。文本;
InputStream is = new URL(url).openStream();
$ b
请建议如何存取 hdfs协议
来自java代码。
在HDFS 8020中是IPC端口,需要打开HDFS HDFS浏览器的Web UI,它的默认端口是50070,从您的Web浏览器打开下面的URL
http:// localhost:50070 / code>,然后转到
实时节点
选项 - >从那里选择一个datanode - >点击浏览文件系统
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.
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
这篇关于在浏览器中打开一个HDFS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!