hdfs read process

1. The client calls open of the filesystem to communicate with nn, and returns part or all of the block list of the file to return the fsdatainputstream object.
2. The client calls the read method of the fsdatainputstream object to read the nearest dn of the first block. After reading, it will check if it is ok to close the communication with dn. If the reading fails, it will record dn+block information. It will not read from this node next time. Then the opportunity to read from the second node, and then to read with the nearest dn of the second block, and so on.
If when the block list is all read and the file has not been read, call filesystem to get the next batch of block list from nn
3. The client calls the fsdatainputstream object close method to close the input stream

Guess you like

Origin blog.51cto.com/15084467/2592963