Elasticsearch cluster health

Posted by jnerotrix on Tue, 18 Jan 2022 01:05:34 +0100

Official website documents:

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

command

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

Return example:

{

  "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
}

Official website original:

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: cluster name

Status: cluster status, indicating whether the current cluster is working normally on the whole. Its three colors have the following meanings:
green: all primary and replica partitions are running normally.
yellow: all primary partitions work normally, but not all replica partitions. At this time, the cluster can normally serve all requests, but there is a risk of data loss in case of hardware failure.
red: the main partition does not work normally.

timed_out: timeout or not

number_of_nodes: number of cluster nodes

number_of_data_nodes: number of data nodes

active_primary_shards: number of primary slices

active_shards: the number of all segments, including primary and secondary segments

relocating_shards: greater than 0 indicates that Elasticsearch is moving data fragments in the cluster to improve load balancing and failover. This usually occurs when a new node is added, a failed node is restarted, or a node is deleted

initializing_shards: the number of slices being initialized. When the user just creates a new index or restarts a node, this value will be greater than 0

unassigned_shards: the number of unassigned replica fragments. Replicas in a single node cluster are unassigned because they are all on one node

delayed_unassigned_shards: delay the number of unassigned copies

number_of_pending_tasks: the number of delegated tasks. Pending tasks can only be processed by the primary node. These tasks include creating indexes and assigning shards to nodes. If the index value has not decreased, it indicates that there are unstable factors in the cluster

number_of_in_flight_fetch: number of incomplete fetches

task_max_waiting_in_queue_millis: the time for the earliest started task to wait for execution until now, which is the maximum waiting time (in milliseconds).

active_shards_percent_as_number: cluster fragment health. The proportion of active fragments in the total fragments. If it is 0, it means it is unavailable. The above case is 100, which indicates that it is very healthy.

Reference blog:

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

Topics: ElasticSearch