集羣狀態查詢

一、獲取集羣狀態的API:
1、請求:GET _cluster/health
2、響應:
{
   "cluster_name": "elasticsearch_zach",
   "status": "green",
   "timed_out": false,
   "number_of_nodes": 1,
   "number_of_data_nodes": 1,
   "active_primary_shards": 10, #集羣中的主分片數量
   "active_shards": 10,#所有索引的所有分片的彙總值,即包括副本分片。
   "relocating_shards": 0,#當前正在從一個節點遷往其他節點的分片的數量
   "initializing_shards": 0,#剛剛創建的分片的個數
   "unassigned_shards": 0#是已經在集羣狀態中存在的分片,但是實際在集羣裏又找不着
}

3、status 字段
green:所有的主分片和副本分片都正常運行
yellow:所有的主分片都正常運行,但不是所有的副本分片都正常運行。
red:有主分片沒能正常運行。

4、查詢集羣的索引清單
GET _cluster/health?level=indices

5、查詢集羣更詳細的信息
GET _cluster/health?level=shards

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