Hadoop HDFS Data Read Operations
HDFS读流程图
i) Client opens the file it wishes to read by calling open() on the FileSystem object, which for HDFS is an instance of DistributedFileSystem.
客户端打开文件, 并调用FileSystem类的open()方法来读文件. 对于HDFS而言是一个DistributedFileSystem的实例.
ii) DistributedFileSystem calls the namenode using RPC to determine the locations of the blocks for the first few blocks in the file. For each block, the namenode returns the addresses of the datanodes that have a copy of that block and datanode are sorted according to their proximity to the client.
DistributedFileSystem发送请求给namenode使用RPC(Rmove Procedure Call)去确定文件中前几个数据块的地址. 对每个数据块, namenode返回拥有该数据块的datanode的地址, 并根据datanode离客户端的距离对他们进行排序.
iii) DistributedFileSystem returns