Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check Elasticsearch cluster health?

I tried to check it via

curl -XGET 'http://localhost:9200/_cluster/health' 

but nothing happened. Seems it's waiting for something. The console did not come back. Had to kill it with CTRL+C.

I also tried to check for existing indices via

curl -XGET 'http://localhost:9200/_cat/indices?v' 

Same behavior as above.

like image 300
mr.proton Avatar asked Dec 08 '14 18:12

mr.proton


People also ask

Why is Elasticsearch cluster health yellow?

Rather, this status indicates that at least one primary shard and its replicas aren't allocated to a node. If your cluster status shows yellow status, then the primary shards for all indices are allocated to nodes in your cluster. However, the replica shards for at least one index aren't allocated to any of the nodes.

What is cluster health?

Health Clusters collectively prepare for and respond to humanitarian and public health emergencies to improve the health outcomes of affected populations through timely, predictable, appropriate and effective coordinated health action.


2 Answers

To check on elasticsearch cluster health you need to use

curl localhost:9200/_cat/health 

More on the cat APIs here.

I usually use elasticsearch-head plugin to visualize that.

You can find it's github project here.

It's easy to install sudo $ES_HOME/bin/plugin -i mobz/elasticsearch-head and then you can open localhost:9200/_plugin/head/ in your web brower.

You should have something that looks like this :

enter image description here

like image 137
eliasah Avatar answered Sep 28 '22 11:09

eliasah


You can check elasticsearch cluster health by using (CURL) and Cluster API provieded by elasticsearch:

$ curl -XGET 'localhost:9200/_cluster/health?pretty' 

This will give you the status and other related data you need.

{  "cluster_name" : "xxxxxxxx",  "status" : "green",  "timed_out" : false,  "number_of_nodes" : 2,  "number_of_data_nodes" : 2,  "active_primary_shards" : 15,  "active_shards" : 12,  "relocating_shards" : 0,  "initializing_shards" : 0,  "unassigned_shards" : 0,  "delayed_unassigned_shards" : 0,  "number_of_pending_tasks" : 0,  "number_of_in_flight_fetch" : 0 } 
like image 29
Raghu Ram Avatar answered Sep 28 '22 11:09

Raghu Ram