源碼分析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

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