# Cluster rebalancing

**URL:** <https://discuss.elastic.co/t/cluster-rebalancing/359057>\
**Category:** Elasticsearch\
**Created:** [May 8, 2024, 12:03pm UTC](https://discuss.elastic.co/t/cluster-rebalancing/359057 "2024-05-08T12:03:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Atefeh](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Atefeh](https://discuss.elastic.co/u/Atefeh)\
**Post date:** [May 8, 2024, 12:03pm UTC](https://discuss.elastic.co/t/cluster-rebalancing/359057/1 "2024-05-08T12:03:49Z")

</div>

I have an issue with ES automatic rebalancing shards in my cluster:

- I’m using Elasticsearch 7.17.9
- I have a cluster with 17 data nodes that all of them have data role
- Data nodes already have cluster.routing.allocation.awareness.attributes : group
  - 12 data nodes set to group hot and 5 of them set to group cold

- Shard allocation settings are in their default setting
- I have 5 shards per index without replica
- I’m using Curator to transition indices between the hot and cold nodes

The shard allocation is as follows:

```auto
shards node
145 hot11
145 hot12
145 hot13
145 hot21
145 hot22
145 hot23
145 hot31
145 hot32
145 hot33
144 hot41
145 hot42
145 hot43
8125 cold1
8126 cold2
8125 cold3
8125 cold4
8125 cold5

```

I expect balancer works independently within each group (Hot and Cold), but it seems that Elastic wants to balance the entire cluster. It starts relocating shards from the cold2 to the hot nodes, but because it can’t match with the node group, it moves back to another cold node and this process is repeated in a loop.

As explain [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/modules-cluster.html#shards-rebalancing-settings)

> If you are using data tiers then Elasticsearch automatically applies allocation filtering rules to place each shard within the appropriate tier. These rules mean that the balancer works independently within each tier.

I changed my data node roles to data\_hot and data\_cold. However, the problem still persists.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [May 8, 2024, 12:40pm UTC](https://discuss.elastic.co/t/cluster-rebalancing/359057/2 "2024-05-08T12:40:12Z")

</div>

> [@Atefeh](#):
>
> I changed my data node roles to data\_hot and data\_cold. However, the problem still persists.

Did you change the role of all your nodes and restarted them?

> [@Atefeh](#):
>
> It starts relocating shards from the cold2 to the hot nodes, but because it can’t match with the node group

Do you have any allocation settings in your indices templates? Please share them.

---

<div class="post-metadata">

**Author:** ![Atefeh](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@Atefeh](https://discuss.elastic.co/u/Atefeh)\
**Post date:** [May 8, 2024, 1:06pm UTC](https://discuss.elastic.co/t/cluster-rebalancing/359057/3 "2024-05-08T13:06:34Z")

</div>

> [@leandrojmp](#):
>
> Did you change the role of all your nodes and restarted them?

yes, I changed all of them and then restarted

> [@leandrojmp](#):
>
> Do you have any allocation settings in your indices templates? Please share them

yes, sure

```auto
"settings": {
	"index": {
		"routing": {
			"allocation": {
				"include": {
					"group": "hot"
				}
			}
		}
	}
}

```

when an index is created, it is initially allocated to the hot group, and then the allocation is changed to cold by using Curator
