# How to fix cluster is red, reason: no\_valid\_shard\_copy after stopping data nodes?

**URL:** <https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206>\
**Category:** Elasticsearch\
**Created:** [December 8, 2021, 10:00am UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206 "2021-12-08T10:00:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bugb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bugb/32/90933_2.png) [@bugb](https://discuss.elastic.co/u/bugb)\
**Post date:** [December 8, 2021, 10:00am UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206/1 "2021-12-08T10:00:34Z")

</div>

After stopping some data nodes, my cluster becomes red and the reason is: no\_valid\_shard\_copy after stopping data nodes?

How can I fix this?

Update: should I use `reroute`?

```auto
POST _cluster/reroute?retry_failed

```

---

<div class="post-metadata">

**Author:** ![preetish\_P](https://avatars.discourse-cdn.com/v4/letter/p/77aa72/32.png) [@preetish\_P](https://discuss.elastic.co/u/preetish_P)\
**Post date:** [December 8, 2021, 1:59pm UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206/2 "2021-12-08T13:59:46Z")

</div>

1. How many data nodes do you have ?
2. Go to index management --\> locate indices with Health = Red . What is the value of 'Replicas' ?

---

<div class="post-metadata">

**Author:** ![bugb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bugb/32/90933_2.png) [@bugb](https://discuss.elastic.co/u/bugb)\
**Post date:** [December 8, 2021, 2:00pm UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206/3 "2021-12-08T14:00:30Z")

</div>

1. I removed 3 data nodes and got the issue
2. value of replica is 0

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 8, 2021, 5:42pm UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206/4 "2021-12-08T17:42:50Z")

</div>

If you have no replica shards you need to [vacate all indices from the nodes yoiu are to remove before actually removing them](https://www.elastic.co/guide/en/elasticsearch/reference/7.15/modules-cluster.html#cluster-shard-allocation-filtering). If you do not, a number of primary shards will no longer be available to the cluster, resulting in a red state and lost data.

To fix this youi need to bring the nodes and the data back before following the process described in the docs I linked to.

---

<div class="post-metadata">

**Author:** ![bugb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bugb/32/90933_2.png) [@bugb](https://discuss.elastic.co/u/bugb)\
**Post date:** [December 9, 2021, 3:31am UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206/5 "2021-12-09T03:31:18Z")

</div>

Thank you a lot!

So I need to start my data nodes (those I turned off)

And then update settings:

```auto
PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.exclude._ip" : "10.0.0.1"
  }
}

```

Right?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 9, 2021, 4:47am UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206/6 "2021-12-09T04:47:58Z")

</div>

How long you need to wait will depend on how much data and how many shards you have. If you enabled a replica you could remove one node at a time as long as you allow Elasticsearch to rebalanced after each one.

---

<div class="post-metadata">

**Author:** ![bugb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bugb/32/90933_2.png) [@bugb](https://discuss.elastic.co/u/bugb)\
**Post date:** [December 9, 2021, 7:39am UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206/7 "2021-12-09T07:39:33Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> How long you need to wait will depend on how much data and how many shards you have

thanks, it works

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 6, 2022, 7:40am UTC](https://discuss.elastic.co/t/how-to-fix-cluster-is-red-reason-no-valid-shard-copy-after-stopping-data-nodes/291206/8 "2022-01-06T07:40:18Z")

</div>

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