源码分析HDFS 数据读、写操作流程和用户指令交互

  • 一、这里首先介绍源码中的四个主要关键类(主要用于用户的hdfs dfs...命令交互实现、数据的读取、数据的写入)

    • DFSClient:

      • HDFS 客户端(如下是源码DFSClient类中的客户端说明信息,这里简述了使用ClientProtocol去访问NameNode线程以及连接DataNode数据目录去读写数据块);

        • DFSClient can connect to a Hadoop Filesystem and perform basic file tasks.  It uses the ClientProtocol to communicate with a NameNode daemon, and connects directly to DataNodes to read/write block data;

        • Hadoop DFS users should obtain an instance of DistributedFileSystem, which uses DFSClient to handle filesystem tasks;

    • DistributedFileSystem

      • 基于抽象类FileSystem实现的分布式HDFS的实现类,其中包含方法有Open、Read、Close、Create、Append等;

      • 也是客户端用户交互的主要类,具体源码说明如下:

        • Implementation of the abstract FileSystem for the DFS system. This object is the way end-user c

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章