You can run commands in the Kibana Dev Tools console to check cluster health, node load, shard allocation, and index information for routine monitoring and troubleshooting.
Prerequisites
You must have an Alibaba Cloud Elasticsearch instance. For more information, see Create an Alibaba Cloud Elasticsearch cluster.
Procedure
Log on to the Kibana console of your Elasticsearch cluster.
For detailed instructions, see Log on to the Kibana console. All commands in this topic can be run in the Dev Tools console.
In the left-side navigation pane, click Dev Tools.
In the Console, run the following command to check the cluster's health status.
GET /_cluster/healthA successful request returns the following response:
{ "cluster_name" : "es-cn-45xxxxxxxxxxxxk1q", "status" : "green", "timed_out" : false, "number_of_nodes" : 2, "number_of_data_nodes" : 2, "active_primary_shards" : 18, "active_shards" : 36, "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 }The
statusfield indicates the cluster health status. Valid values aregreen,yellow, andred.Status
State
Description
red
Not all primary shards are available.
One or more primary shards are unassigned.
yellow
All primary shards are available, but not all replica shards are available.
One or more replica shards are unassigned.
green
All primary and replica shards are available.
All primary and replica shards are assigned.
A
yellowcluster status can significantly slow down operations such as password changes and instance upgrades. Before performing these operations, restore your cluster to thegreenstatus. A common reason for ayellowstatus is that the number of replicas for an index is greater than the number of available nodes minus one. To fix this, follow these steps:Find the indices with a
yellowstatus:curl -u <username>:<password> http://<host>:9200/_cat/indicesAdjust the number of replicas for the affected index, setting the value to one less than the number of available nodes.
curl -XPUT -u <username>:<password> http://<host>:9200/<problematic_index_name>/_settings -H 'Content-Type: application/json' -d '{"index":{"number_of_replicas":(<number_of_nodes - 1>)}'NoteAfter restarting or scaling an instance, adjust the number of replicas for your indices to match the new node count.
Cluster commands
Command | Description |
GET /_cat/health?v | Returns the cluster health status (green, yellow, or red). For status descriptions, see the table above. |
GET /_cluster/health?pretty=true | Returns the health status of the cluster. The
|
GET /_cluster/stats | Returns cluster statistics, including CPU and JVM information. |
GET /_cluster/state | Returns detailed information about the cluster state, including nodes and shards. |
GET /_cluster/pending_tasks | Returns the pending tasks in the cluster. |
GET /_cluster/settings | Returns the cluster-wide settings. |
Node commands
Command | Description |
GET /_cat/master?v | Returns information about the master node. |
GET /_cat/nodes?v | Returns the current status of each node, including CPU usage, heap memory usage, and load. |
GET /_cat/nodeattrs?v | Returns the custom attributes of each node. |
GET /_nodes/stats?pretty=true | Returns node statistics. |
GET /_nodes/process | Returns process information for nodes. |
GET /_nodes/hot_threads | Returns tasks that are consuming high amounts of CPU. |
GET /_nodes/<nodeip>/jvm,process,os | Returns JVM, process, and operating system (OS) information for a specified node. |
GET /_cat/plugins?v | Returns the plugins installed on each node. |
GET /_cat/thread_pool?v | Returns thread pool statistics for each node, including thread pool type, number of active threads, and queue size. |
Shard commands
Command | Description |
GET /_cat/shards?v | Returns detailed information about each shard, such as its index name, shard ID, type (primary or replica), status, document count, and disk usage. The output includes a failure reason for any failed shards. To view shard information for a specific index, run |
GET /_cat/allocation?v | Returns the shard allocation for each node. |
GET /_cat/recovery?v | Returns the recovery progress for each shard. |
Segment commands
GET /_cat/segments?vReturns segment information for each index, such as segment name, the shard it belongs to, memory or disk usage, and whether it has been flushed to disk. You can also view segment information for a specific index by running GET _cat/segments/<index>?v.
Index commands
Command | Description |
GET /_cat/indices?v | Returns detailed information for all indices, including health status, state, shard and replica counts, and document count. To view information for a specific index, run |
GET /_cat/aliases?v | Returns information about all index aliases, including the indices they point to and their routing configurations. |
Mapping commands
Command | Description |
GET /_mapping | Returns the mappings for all indices. |
GET /<index>/_mapping | Returns the mapping for a specific index. |
Document commands
Command | Description |
GET /_cat/count?v | Returns the total document count in the cluster. To view the count for a specific index, run |
GET /<index>/_doc/<id> | Retrieves the data from a specific document. |
Snapshot commands
Command | Description |
GET _snapshot/_all | Returns all snapshots. |
GET _snapshot/<snapshot_name>/_status | Returns the progress of a specified snapshot. |