# Shard rebalancing vs shard allocation

**URL:** https://discuss.elastic.co/t/shard-rebalancing-vs-shard-allocation/154492
**Category:** Elasticsearch
**Created:** [October 29, 2018, 7:07pm UTC](https://discuss.elastic.co/t/shard-rebalancing-vs-shard-allocation/154492 "2018-10-29T19:07:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![HugoP](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugop/32/43435_2.png) [@HugoP](https://discuss.elastic.co/u/HugoP)
#### Post date: [October 29, 2018, 7:07pm UTC](https://discuss.elastic.co/t/shard-rebalancing-vs-shard-allocation/154492/1 "2018-10-29T19:07:29Z")

</div>

Hi,

What is the difference/link between shard rebalancing and shard allocation ?

Is it possible to have a shard rebalancing with a disable sharding allocation ? I don't think so but I need some confirmation.

Furthermore, in the elastic rolling upgrade procedure ([https://www.elastic.co/guide/en/elasticsearch/reference/current/rolling-upgrades.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/rolling-upgrades.html)), it is advised to disable shard allocation. My guess is that this step is necessary to prevent the cluster from creating new shards in order to satisfy the number of shards specified for the indices.

I have already read this topic ([Difference between 'rebalance.enable' and 'allocation.enable'](https://discuss.elastic.co/t/difference-between-rebalance-enable-and-allocation-enable/115994)) but I find the explanation quite vague.

Thanks for your help,

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [October 30, 2018, 1:23pm UTC](https://discuss.elastic.co/t/shard-rebalancing-vs-shard-allocation/154492/2 "2018-10-30T13:23:45Z")

</div>

> [@HugoP](#):
>
> What is the difference/link between shard rebalancing and shard allocation ?

Shard allocation is about taking unassigned shard copies and finding each of them a node to inhabit. Rebalancing is about taking assigned shard copies and moving them to different nodes to even out the distribution of shards.

> [@HugoP](#):
>
> Is it possible to have a shard rebalancing with a disable sharding allocation ? I don't think so but I need some confirmation.

You are correct - for rebalancing to move a shard between nodes it needs to allocate the shard on the target node, which isn't allowed if allocation is disabled.

> [@HugoP](#):
>
> My guess is that this step is necessary to prevent the cluster from creating new shards in order to satisfy the number of shards specified for the indices.

Possibly, but this isn't the terminology we normally use. You can create new shard copies by (a) creating an index or (b) increasing the number of replicas of an existing index, but I think this isn't what you meant by "creating new shards": I think you were talking about assigning unassigned shards.

Allocating a shard to a node involves copying its data from the primary, which could be an expensive and time-consuming operation. During a rolling restart this is unnecessary because each node is only temporarily unavailable, so it's better to leave the shards where they are until the node rejoins the cluster.

---

<div class="post-metadata">

### Author: ![HugoP](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugop/32/43435_2.png) [@HugoP](https://discuss.elastic.co/u/HugoP)
#### Post date: [October 31, 2018, 1:52pm UTC](https://discuss.elastic.co/t/shard-rebalancing-vs-shard-allocation/154492/3 "2018-10-31T13:52:11Z")

</div>

Thank you very much for this very good answer !

> Possibly, but this isn't the terminology we normally use. You can create new shard copies by (a) creating an index or (b) increasing the number of replicas of an existing index, but I think this isn't what you meant by "creating new shards": I think you were talking about assigning unassigned shards.

And you are absolutely right: I was talking about unassigned shards.

Have a good day,

---

<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 28, 2018, 1:52pm UTC](https://discuss.elastic.co/t/shard-rebalancing-vs-shard-allocation/154492/4 "2018-11-28T13:52:14Z")

</div>

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