# Why does Elasticsearch choose to relocate shards?

**URL:** <https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939>\
**Category:** Elasticsearch\
**Created:** [October 25, 2018, 8:13am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939 "2018-10-25T08:13:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimWard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timward/32/19574_2.png) [@TimWard](https://discuss.elastic.co/u/TimWard)\
**Post date:** [October 25, 2018, 8:13am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939/1 "2018-10-25T08:13:10Z")

</div>

I've read [https://www.elastic.co/blog/every-shard-deserves-a-home](https://www.elastic.co/blog/every-shard-deserves-a-home) but can't see how any of the cases there apply.

ES seems to be spending all its time moving shards around, sometimes apparently taking hours to move multi-gigabyte shards, occupying both the two-things-at-once that it seems to like doing, thus other, smaller, shards remain "yellow" for hours waiting for a chance to run.

How do I find out what's going on and why?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 25, 2018, 8:56am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939/2 "2018-10-25T08:56:59Z")

</div>

What version are you on?

---

<div class="post-metadata">

**Author:** ![TimWard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timward/32/19574_2.png) [@TimWard](https://discuss.elastic.co/u/TimWard)\
**Post date:** [October 25, 2018, 9:23am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939/3 "2018-10-25T09:23:36Z")

</div>

6.2.4

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 25, 2018, 9:26am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939/4 "2018-10-25T09:26:57Z")

</div>

It seems very odd that it would be continually moving things.

How much disk space do you have on your nodes?

---

<div class="post-metadata">

**Author:** ![TimWard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timward/32/19574_2.png) [@TimWard](https://discuss.elastic.co/u/TimWard)\
**Post date:** [October 25, 2018, 9:39am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939/5 "2018-10-25T09:39:57Z")

</div>

1. 165G, 81% used
2. 165G, 71% used
3. 165G, 53% used

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 25, 2018, 9:52am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939/6 "2018-10-25T09:52:13Z")

</div>

It might be moving them from the first node due to watermarks - [https://www.elastic.co/guide/en/elasticsearch/reference/6.4/disk-allocator.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.4/disk-allocator.html)

What do the logs show?

---

<div class="post-metadata">

**Author:** ![TimWard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timward/32/19574_2.png) [@TimWard](https://discuss.elastic.co/u/TimWard)\
**Post date:** [October 25, 2018, 10:12am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939/7 "2018-10-25T10:12:05Z")

</div>

I assumed it wouldn't be that because the disk usage is below 85%. But ... the largest shards it moves around are 7.9G, which is more than 4% of 165G, and 81% + 4.7% \> 85% so perhaps that is indeed what's going on, although I've never seen actual usage above 85%.

Thank you for pointing me at the logs - I deleted all the historical logs from the node that was at 81% and it's now at 71% ... the logs themselves are full of errors which I supposed I'd better clean up before trying to find anything in there about relocating shards.

---

<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:** [November 22, 2018, 10:12am UTC](https://discuss.elastic.co/t/why-does-elasticsearch-choose-to-relocate-shards/153939/8 "2018-11-22T10:12:05Z")

</div>

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