Exploring Your Cluster

 Cluster Health

https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-cluster-health.html

C:\WINDOWS\system32>curl -X GET "localhost:9200/_cat/health?v"

结果如下,列是对齐的

epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1551867679 10:21:19  elasticsearch green           1         1      0   0    0    0        0             0                  -                100.0%

We can see that our cluster named "elasticsearch" is up with a green status.

Whenever we ask for the cluster health, we either get green, yellow, or red.

  • Green - everything is good (cluster is fully functional)
  • Yellow - all data is available but some replicas are not yet allocated (cluster is fully functional)
  • Red - some data is not available for whatever reason (cluster is partially functional)

Note: When a cluster is red, it will continue to serve search requests from the available shards but you will likely need to fix it ASAP since there are unassigned shards.

Also from the above response, we can see a total of 1 node and that we have 0 shards since we have no data in it yet.

Note that since we are using the default cluster name (elasticsearch) and since Elasticsearch uses unicast network discovery by default to find other nodes on the same machine, it is possible that you could accidentally start up more than one node on your computer and have them all join a single cluster. In this scenario, you may see more than 1 node in the above response.

We can also get a list of nodes in our cluster as follows:

curl -X GET "localhost:9200/_cat/nodes?v"

ip        heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
127.0.0.1           18          62  28                          mdi       *      WqeJVip

Here, we can see our one node named "WqeJVip", which is the single node that is currently in our cluster.

猜你喜欢

转载自www.cnblogs.com/chucklu/p/10485105.html