How can I fix yellow state cluster?

Hello.

I have to reboot one of my 3 node cluster node and now one index is in the yellow state .

curl -XGET localhost:9200/_cluster/health/my_index | jq '.'
{
  "cluster_name": "cl1",
  "status": "yellow",
  "timed_out": false,
  "number_of_nodes": 3,
  "number_of_data_nodes": 3,
  "active_primary_shards": 5,
  "active_shards": 8,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 2,
  "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": 96.7741935483871
}

What does it mean "active_shards_percent_as_number": 96.7741935483871 ?

And how can I get green state ?

{
 "cluster_name": "cl1",
 "status": "yellow",
 "timed_out": false,
 "number_of_nodes": 3,
 "number_of_data_nodes": 3,
 "active_primary_shards": 5,
 "active_shards": 8,
 "relocating_shards": 0,
 "initializing_shards": 0,
 "unassigned_shards": 2,
 "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": 96.7741935483871,
 "indices": {
   "my_index": {
     "status": "yellow",
     "number_of_shards": 5,
     "number_of_replicas": 1,
     "active_primary_shards": 5,
     "active_shards": 8,
     "relocating_shards": 0,
     "initializing_shards": 0,
     "unassigned_shards": 2,
     "shards": {
       "0": {
         "status": "green",
         "primary_active": true,
         "active_shards": 2,
         "relocating_shards": 0,
         "initializing_shards": 0,
         "unassigned_shards": 0
       },
       "1": {
         "status": "green",
         "primary_active": true,
         "active_shards": 2,
         "relocating_shards": 0,
         "initializing_shards": 0,
         "unassigned_shards": 0
       },
       "2": {
         "status": "green",
         "primary_active": true,
         "active_shards": 2,
         "relocating_shards": 0,
         "initializing_shards": 0,
         "unassigned_shards": 0
       },
       "3": {
         "status": "yellow",
         "primary_active": true,
         "active_shards": 1,
         "relocating_shards": 0,
         "initializing_shards": 0,
         "unassigned_shards": 1
       },
       "4": {
         "status": "yellow",
         "primary_active": true,
         "active_shards": 1,
         "relocating_shards": 0,
         "initializing_shards": 0,
         "unassigned_shards": 1
       }
     }
   }
 }
}

As long as all your nodes are using exactly the same version of Elasticsearch and there is enough space on disk this should fix itself. You can use the cluster allocation explain API to find out why the missing shards are not assigned.

Yes. Thanks.
Fixed by curl -XPOST localhost:9200/_cluster/reroute?retry_failed=true

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.