[ 
https://issues.apache.org/jira/browse/HDFS-6001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13910546#comment-13910546
 ] 

Chris Nauroth commented on HDFS-6001:
-------------------------------------

[~jerryhe], it sounds like you want to discover the host behind a 
{{FileSystem}}.  (Again, we don't have the larger context here, but I'm going 
to take a guess that this is your goal.)  In a federated deployment, this is 
complicated by the fact that the namesystem is spread across multiple hosts, so 
the host "behind" the file system is going to be sensitive to a specific path.

You could potentially use {{FileSystem#resolvePath}} to get the fully-qualified 
{{Path}} for a specific file system path:

http://hadoop.apache.org/docs/r2.2.0/api/org/apache/hadoop/fs/FileSystem.html#resolvePath(org.apache.hadoop.fs.Path)

This method fully resolves through the client-side mount table and also 
symlinks.  Then, you could call {{Path#toUri}} to change the {{Path}} back into 
a {{URI}}:

http://hadoop.apache.org/docs/r2.2.0/api/org/apache/hadoop/fs/Path.html#toUri()

At this point, you'd have a URI containing the real host that backs that part 
of the namespace.

Therefore, in addition to statements from others that this is not a bug, I'd 
also say that there is no functionality gap that needs to be filled.

Does that answer your questions?  If so, then I'd like to resolve as won't fix 
later today.

> In HDFS HA setup, FileSystem.getUri returns hdfs://<dfs.nameservices>
> ---------------------------------------------------------------------
>
>                 Key: HDFS-6001
>                 URL: https://issues.apache.org/jira/browse/HDFS-6001
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: ha
>    Affects Versions: 2.2.0
>            Reporter: Jerry He
>            Priority: Minor
>
> When hdfs is set up with HA enable, FileSystem.getUri returns 
> hdfs://<the-value-of-dfs.nameservices>
> Here dfs.nameservices is defined when HA is enabled. In documentation:
> {quote}
> dfs.nameservices - the logical name for this new nameserviceChoose a logical 
> name for this nameservice, for example "mycluster", and use this logical name 
> for the value of this config option. The name you choose is arbitrary. It 
> will be used both for configuration and as the authority component of 
> absolute HDFS paths in the cluster.
> Note: If you are also using HDFS Federation, this configuration setting 
> should also include the list of other nameservices, HA or otherwise, as a 
> comma-separated list.
> <property>
>   <name>dfs.nameservices</name>
>   <value>mycluster</value>
> </property>
> {quote}
> This is probably ok or even intended.  But a caller may further process the 
> URI, for example, call URI.getHost(). This will return the 'mycluster', which 
> is not a valid host anywhere.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to