PrepAway - Latest Free Exam Questions & Answers

Which describes how a client reads a file from HDFS?

Which describes how a client reads a file from HDFS?

PrepAway - Latest Free Exam Questions & Answers

A.
The client queries the NameNode for the block location(s). The NameNode returns the block
location(s) to the client. The client reads the data directory off the DataNode(s).

B.
The client queries all DataNodes in parallel. The DataNode that contains the requested data
responds directly to the client. The client reads the data directly off the DataNode.

C.
The client contacts the NameNode for the block location(s). The NameNode then queries the
DataNodes for block locations. The DataNodes respond to the NameNode, and the NameNode
redirects the client to the DataNode that holds the requested data block(s). The client then reads
the data directly off the DataNode.

D.
The client contacts the NameNode for the block location(s). The NameNode contacts the
DataNode that holds the requested data block. Data is transferred from the DataNode to the
NameNode, and then from the NameNode to the client.

Explanation:
The Client communication to HDFS happens using Hadoop HDFS API. Client
applications talk to the NameNode whenever they wish to locate a file, or when they want to
add/copy/move/delete a file on HDFS. The NameNode responds the successful requests by
returning a list of relevant DataNode servers where the data lives. Client applications can talk
directly to a DataNode, once the NameNode has provided the location of the data.
Reference: 24 Interview Questions & Answers for Hadoop MapReduce developers, How the Client
communicates with HDFS?

8 Comments on “Which describes how a client reads a file from HDFS?

  1. GS says:

    The answer is “A”, Upon a client request Namenode pulls the information about the blocks location and replication/datanode info from its memory and returns to the client. Then client talks to the datanode directly.




    1



    0
  2. Oleg says:

    Answer is “A”.
    – Client will contact NN first with the request “Give me info on this file”
    – NN will reply back with list of all blocks for a given file and list of DN for each block
    – Client will start download data from the nearest DN




    0



    0
  3. Suresh Reddy Chaganti says:

    like everybody mentioned above A is the right answer,
    why will name node again queries data nodes for block locations, when name node getting heart- beat and block reports continuously ??




    0



    0

Leave a Reply

Your email address will not be published. Required fields are marked *