<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: how to Find Block Locations of a file in HDFS using JAVA API? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/349703#M74482</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99648"&gt;@husseljo&lt;/a&gt;,&amp;nbsp;as this is an older post, you would have a better chance of receiving a resolution by&lt;A href="“https://community.cloudera.com/t5/forums/postpage/board-id/Questions”" target="_blank"&gt; starting a new thread&lt;/A&gt;. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Aug 2022 10:17:56 GMT</pubDate>
    <dc:creator>VidyaSargur</dc:creator>
    <dc:date>2022-08-08T10:17:56Z</dc:date>
    <item>
      <title>how to Find Block Locations of a file in HDFS using JAVA API?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/213548#M74479</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i want to get details "Block-Locations" of a particular file say abc.csv(500mb)(Cluster: 1NM and 3DNs).&lt;/P&gt;&lt;P&gt;when i -put a file it is divided into blocks of default size 64MB and spread across Hadoop Cluster.&lt;/P&gt;&lt;P&gt;By using Web interface "http://namenode:50070" we can find out block location across cluster.&lt;/P&gt;&lt;P&gt;Also by using command : hadoop fsck &amp;lt;file-pat&amp;gt; -files -blocks -locations&lt;/P&gt;&lt;P&gt;But what i am trying to achieve is to get these information through JAVA API or WEB- API.&lt;/P&gt;&lt;P&gt;Please let me know the solution if any.&lt;/P&gt;&lt;P&gt;Any help will be appretiated.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2018 16:14:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/213548#M74479</guid>
      <dc:creator>YoxBox</dc:creator>
      <dc:date>2018-02-10T16:14:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to Find Block Locations of a file in HDFS using JAVA API?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/213549#M74480</link>
      <description>&lt;P&gt;@Yog Prabhhu, you can get the file block information from WebHDFS REST API like&lt;/P&gt;&lt;PRE&gt;curl -i "http://&amp;lt;HOST&amp;gt;:&amp;lt;PORT&amp;gt;/webhdfs/v1/&amp;lt;FilePath&amp;gt;?op=GETFILEBLOCKLOCATIONS&lt;/PRE&gt;&lt;P&gt;The corresponding JAVA API is FileSystem.getFileBlockLocations:&lt;/P&gt;&lt;PRE&gt;public BlockLocation[] getFileBlockLocations(FileStatus file,
    long start, long len)
&lt;/PRE&gt;&lt;P&gt;You will get an array of block locations like below:&lt;/P&gt;&lt;PRE&gt;[BlockLocation(offset: 0, length: BLOCK_SIZE,*   hosts: {"host1:9866", "host2:9866, host3:9866"},...,]&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Feb 2018 03:23:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/213549#M74480</guid>
      <dc:creator>xyao</dc:creator>
      <dc:date>2018-02-14T03:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to Find Block Locations of a file in HDFS using JAVA API?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/349672#M74481</link>
      <description>&lt;P&gt;Hey, do you have an idea how I can actually locate and read a specific block using BlockLocation? I want to read the block byte by byte.(I understand it might be a remote read)&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 01:03:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/349672#M74481</guid>
      <dc:creator>husseljo</dc:creator>
      <dc:date>2022-08-08T01:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to Find Block Locations of a file in HDFS using JAVA API?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/349703#M74482</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99648"&gt;@husseljo&lt;/a&gt;,&amp;nbsp;as this is an older post, you would have a better chance of receiving a resolution by&lt;A href="“https://community.cloudera.com/t5/forums/postpage/board-id/Questions”" target="_blank"&gt; starting a new thread&lt;/A&gt;. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 10:17:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/how-to-Find-Block-Locations-of-a-file-in-HDFS-using-JAVA-API/m-p/349703#M74482</guid>
      <dc:creator>VidyaSargur</dc:creator>
      <dc:date>2022-08-08T10:17:56Z</dc:date>
    </item>
  </channel>
</rss>

