Index Lifecycle Policy not deleting - "Waiting for all shard copies to be active"

Can anyone help me with this? The policy is not deleting my indices after certain time. I put them to just to several days to see if its working. I am getting the message in my indices: Waiting for all shard copies to be active
How can I do this? I just have one Node atm.

ILM Policy

{
  "ilm_policy" : {
    "version" : 1,
    "modified_date" : "2022-04-29T08:40:26.334Z",
    "policy" : {
      "phases" : {
        "warm" : {
          "min_age" : "2d",
          "actions" : {
            "set_priority" : {
              "priority" : 50
            }
          }
        },
        "hot" : {
          "min_age" : "0ms",
          "actions" : {
            "set_priority" : {
              "priority" : 100
            },
            "rollover" : {
              "max_age" : "2d"
            }
          }
        },
        "delete" : {
          "min_age" : "3d",
          "actions" : {
            "delete" : {
              "delete_searchable_snapshot" : true
            }
          }
        }
      }
    },
    "in_use_by" : {
      "indices" : [
        "log-IDENTIFIER-000006",
        "log-IDENTIFIER-000005",
        "identities-00001",
        "log-IDENTIFIER-000004",
        "log-IDENTIFIER-000003",
        "log-IDENTIFIER000002",
        "identities-000002",
        "identities-000006",
        "identities-000005",
        "identities-000004",
        "log-IDENTIFIER-00001",
        "identities-000003"
      ],
      "data_streams" : [ ],
      "composable_templates" : [
        "identities_template",
        "data_logs_template"
      ]
    }
  }

One of the Index, which should be deleted already

{
  "indices" : {
    "log-IDENTIFIER-00001" : {
      "index" : "log-IDENTIFIER-00001",
      "managed" : true,
      "policy" : "logs_ilm_policy",
      "lifecycle_date" : "2022-05-06T13:28:36.985Z",
      "lifecycle_date_millis" : 1651843716985,
      "age" : "9.85d",
      "phase" : "warm",
      "phase_time" : "2022-05-08T13:38:36.884Z",
      "phase_time_millis" : 1652017116884,
      "action" : "migrate",
      "action_time" : "2022-05-08T13:38:37.087Z",
      "action_time_millis" : 1652017117087,
      "step" : "check-migration",
      "step_time" : "2022-05-08T13:38:37.708Z",
      "step_time_millis" : 1652017117708,
      "step_info" : {
        "message" : "Waiting for all shard copies to be active",
        "shards_left_to_allocate" : -1,
        "all_shards_active" : false,
        "number_of_replicas" : 1
      },
      "phase_execution" : {
        "policy" : "ilm_policy",
        "phase_definition" : {
          "min_age" : "2d",
          "actions" : {
            "set_priority" : {
              "priority" : 50
            }
          }
        },
        "version" : 1,
        "modified_date" : "2022-04-29T08:40:26.334Z",
        "modified_date_in_millis" : 1651221626334
      }
    }
  }
}

Cluster Health

{
  "cluster_name" : "NAME",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 50,
  "active_shards" : 50,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 32,
  "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" : 60.97560975609756
}

That's why. You need to set your replica's to 0 so that your cluster is green. You will never allocate your replicas on a single node :slight_smile:

4 Likes

Do I need to set it just in the Index-Template?

Ideally, yes.

You can do it dynamically thought - curl -H "Content-Type: application/json" -XPUT localhost:9200/*/_settings -d '{ "index" : { "number_of_replicas" : 0 } }'.

1 Like

Ok and if I do it just for the Templates, will it update for existing indices as well? Or do I need to update my indices manually?

Ok I just found with this command:

PUT /_settings
{
  "index":{
    "number_of_replicas": 0
  }
}

And all my indices and Cluster health went to status Green. And some indices went into status "delete"

Thanks for the help :grinning:

3 Likes

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