1.es提供了一个可以获取集群健康状态的api,访问http://url:9200/_cluster/health?pretty 和 Elasticsearch 里其他 API 一样,cluster-health 会返回一个 JSON 响应。
内容解析:
"cluster_name": "my-es", #集群名
"status": "yellow", #集群健康状态,正常的话是green,缺少副本分片为yellow,缺少主分片为red "timed_out": false,
"number_of_nodes": 1,#集群节点数
"number_of_data_nodes": 1,#数据节点数
"active_primary_shards": 15,#主分片数
"active_shards": 15,#可用的分片数
"relocating_shards": 0,#正在迁移的分片数
"initializing_shards": 0,#正在初始化的分片数
"unassigned_shards": 15, #未分配的分片,但在集群中存在
"delayed_unassigned_shards": 0, #延时待分配到具体节点上的分片数
"number_of_pending_tasks": 0, #待处理的任务数,指主节点创建索引并分配shards等任务
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 0,
"active_shards_percent_as_number": 50