其他分享
首页 > 其他分享> > Elasticsearch集群健康

Elasticsearch集群健康

作者:互联网

官网文档:

https://www.elastic.co/guide/en/elasticsearch/reference/7.13/cluster-health.html#cluster-health-api-request

命令

curl -XGET 'http://ip:9200/_cluster/health?pretty'

返回举例:

{

  "cluster_name" : "xwliu07-application",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 5,
  "active_shards" : 10,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

官网原文:

Response bodyedit
cluster_name
(string) The name of the cluster.
status
(string) Health status of the cluster, based on the state of its primary and replica shards. Statuses are:

green
All shards are assigned.
yellow
All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
red
One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
timed_out
(Boolean) If false the response returned within the period of time that is specified by the timeout parameter (30s by default).
number_of_nodes
(integer) The number of nodes within the cluster.
number_of_data_nodes
(integer) The number of nodes that are dedicated data nodes.
active_primary_shards
(integer) The number of active primary shards.
active_shards
(integer) The total number of active primary and replica shards.
relocating_shards
(integer) The number of shards that are under relocation.
initializing_shards
(integer) The number of shards that are under initialization.
unassigned_shards
(integer) The number of shards that are not allocated.
delayed_unassigned_shards
(integer) The number of shards whose allocation has been delayed by the timeout settings.
number_of_pending_tasks
(integer) The number of cluster-level changes that have not yet been executed.
number_of_in_flight_fetch
(integer) The number of unfinished fetches.
task_max_waiting_in_queue_millis
(integer) The time expressed in milliseconds since the earliest initiated task is waiting for being performed.
active_shards_percent_as_number
(float) The ratio of active shards in the cluster expressed as a percentage.

cluster_name:集群名称

status:集群状态,指示着当前集群在总体上是否工作正常。它的三种颜色含义如下:
green:所有的主分片和副本分片都正常运行。
yellow:所有的主分片都正常运行,但不是所有的副本分片都正常运行,此时集群可以正常服务所有请求,但是在硬件故障时有丢失数据的风险。
red:有主分片没能正常运行。

timed_out:是否超时

number_of_nodes:集群节点数量

number_of_data_nodes:数据节点数量

active_primary_shards:主分片数量

active_shards:所有分片数量包括主副分片

relocating_shards:大于 0 表示 Elasticsearch 正在集群内移动数据的分片 , 来提升负载均衡和故 障转移。这通常发生在添加新节点、重启失效的节点或者删除节点的时候

initializing_shards:正在初始化的分片数量,当用户刚刚创建一个新的索引或者重启一个节点的时候,这个数值会大于 0

unassigned_shards:未分配的副本分片数量,单节点集群中副本是未分配的,因为都在一个节点上

delayed_unassigned_shards:延迟未分配的副本数量

number_of_pending_tasks :代办的任务数量,pending task只能由主节点来进行处理,这些任务包括创建索引并将shards分配给节点,如果该指标数值一直未减小代表集群存在不稳定因素

number_of_in_flight_fetch : 未完成的提取次数 

task_max_waiting_in_queue_millis : 最早启动的任务等待执行到目前的时间,就是最大等待时长(以毫秒为单位)。

active_shards_percent_as_number:集群分片健康度,活跃分片数占总分片数比例,如果为 0 则表示不可用,上述案例是100说明很健康。

参考博客:

https://www.elastic.co/guide/en/elasticsearch/reference/7.13/cluster-health.html#cluster-health-api-request

https://blog.csdn.net/nandao158/article/details/109024164

https://www.jianshu.com/p/7540ebec4096

https://blog.csdn.net/u010824591/article/details/78614505

标签:integer,shards,number,cluster,集群,分片,active,Elasticsearch,健康
来源: https://blog.csdn.net/single_wolf_wolf/article/details/118731671