使用hadoop_restful_api實現對集羣信息的一些統計

(適用於hadoop 2.7及以上版本)html

涉及到RESTful API

1. 統計HDFS文件系統實時使用狀況

  • URL
    http://emr-header-1:50070/webhdfs/v1/?user.name=hadoop&op=GETCONTENTSUMMARYui

  • 返回結果:this

    {"ContentSummary":
    {"directoryCount": 2,"fileCount"     : 1,"length"        : 24930,"quota"         : -1,"spaceConsumed" : 24930,"spaceQuota"    : -1}
    }
  • 關於返回結果的說明:spa

    {"name"      : "ContentSummary","properties":
    {"ContentSummary":
    {  "type"      : "object",  "properties":
      {    "directoryCount":
        {      "description": "The number of directories.",      "type"       : "integer",      "required"   : true
        },    "fileCount":
        {      "description": "The number of files.",      "type"       : "integer",      "required"   : true
        },    "length":
        {      "description": "The number of bytes used by the content.",      "type"       : "integer",      "required"   : true
        },    "quota":
        {      "description": "The namespace quota of this directory.",      "type"       : "integer",      "required"   : true
        },    "spaceConsumed":
        {      "description": "The disk space consumed by the content.",      "type"       : "integer",      "required"   : true
        },    "spaceQuota":
        {      "description": "The disk space quota.",      "type"       : "integer",      "required"   : true
        }
      }
    }
    }
    }
  • 注意length與spaceConsumed的關係,跟hdfs副本數有關。orm

  • 若是要統計各個組工做目錄的使用狀況,使用以下請求:
    htm

http://emr-header-1:50070/webhdfs/v1/user/feed_aliyun?user.name=hadoop&op=GETCONTENTSUMMARY




全文連接

相關文章
相關標籤/搜索