用于访问HDFS中文件的URI [英] URI to access a file in HDFS

查看:96
本文介绍了用于访问HDFS中文件的URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Ambari设置了一个包含3个节点的集群.

I have setup a cluster using Ambari that includes 3 nodes .

现在,我想使用客户端应用程序访问HDFS中的文件.

Now I want to access a file in a HDFS using my client application.

我可以在Amabari的数据节点"下找到所有节点URI.

I can find all node URIs under Data Nodes in Amabari.

访问文件我需要使用什么URI +端口?我已经使用了默认的安装过程.

What is the URI + Port I need to use to access a file ? I have used the default installation process.

推荐答案

默认端口为"8020".

Default port is "8020".

您可以通过3种不同的方式访问"hdfs"路径.

You can access the "hdfs" paths in 3 different ways.

  1. 只需使用"/"作为根路径

  1. Simply use "/" as the root path

例如

E:\HadoopTests\target>hadoop fs -ls /
Found 6 items
drwxrwxrwt   - hadoop  hdfs          0 2015-08-17 18:43 /app-logs
drwxr-xr-x   - mballur hdfs          0 2015-11-24 15:36 /tmp
drwxrwxr-x   - mballur hdfs          0 2015-10-20 15:27 /user

  • 使用"hdfs:///"

  • Use "hdfs:///"

    例如

    E:\HadoopTests\target>hadoop fs -ls hdfs:///
    Found 6 items
    drwxrwxrwt   - hadoop  hdfs          0 2015-08-17 18:43 hdfs:///app-logs
    drwxr-xr-x   - mballur hdfs          0 2015-11-24 15:36 hdfs:///tmp
    drwxrwxr-x   - mballur hdfs          0 2015-10-20 15:27 hdfs:///user
    

  • 使用"hdfs://{NameNodeHost}:8020/"

  • Use "hdfs://{NameNodeHost}:8020/"

    例如

    E:\HadoopTests\target>hadoop fs -ls hdfs://MBALLUR:8020/
    Found 6 items
    drwxrwxrwt   - hadoop  hdfs          0 2015-08-17 18:43 hdfs://MBALLUR:8020/app-logs
    drwxr-xr-x   - mballur hdfs          0 2015-11-24 15:36 hdfs://MBALLUR:8020/tmp
    drwxrwxr-x   - mballur hdfs          0 2015-10-20 15:27 hdfs://MBALLUR:8020/user
    

    在这种情况下,"MBALLUR"是我的名称节点主机的名称.

    In this case, "MBALLUR" is the name of my Name Node host.

    这篇关于用于访问HDFS中文件的URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆