# ES 6.5.2 Shards on the same physical server do not automatically relocate to another server after cluster.routing.allocation.same\_shard.host is set to true

**URL:** <https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543>\
**Category:** Elasticsearch\
**Created:** [December 19, 2018, 3:11pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543 "2018-12-19T15:11:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [December 19, 2018, 3:11pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/1 "2018-12-19T15:11:36Z")

</div>

Hi Elastic Team,

I have got a number of physical servers, on each of which I run multiple ES data nodes.

Because of this setup, sometimes there would be same replica shards on the same physical server.

I have set the [cluster.routing.allocation.same\_shard.host](https://www.elastic.co/guide/en/elasticsearch/reference/current/shards-allocation.html) to true and it does work but only for newly created shards.

The existing shards that had been created before the above cluster setting was applied do not automatically relocate to another node living on a different physical server and I'm not sure whether this is an intentional behaviour?

If I wanted to force same shards living on the same physical server to get relocated to a different physical server - how can I do that?

Many thanks for you help,

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [December 21, 2018, 10:20am UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/2 "2018-12-21T10:20:06Z")

</div>

Take a look at [shard allocation awareness](https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-awareness.html). It allows you to tag nodes with a label based on the physical machine that they run on using the `node.attr` setting. Elasticsearch will then try to distribute copies of the same shard evenly across the different physical machines.

---

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [December 27, 2018, 8:21am UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/3 "2018-12-27T08:21:33Z")

</div>

Many thanks for the reply Abdon,

One more question please. I do know about shard allocation awareness feature but also saw that [cluster.routing.allocation.same\_shard.host](https://www.elastic.co/guide/en/elasticsearch/reference/current/shards-allocation.html) is meant to help with a similar purpose - should I use both or in other words is there a reason why we have two features that do a kinda similar thing?

---

<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 27, 2018, 8:59am UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/4 "2018-12-27T08:59:27Z")

</div>

Are you nodes running side by side directly on the host or are you using containers?

---

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [January 3, 2019, 11:56am UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/5 "2019-01-03T11:56:46Z")

</div>

Hi Christian,

I'm not using containers. Nodes are run in the same OS / environment.

---

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [January 9, 2019, 12:08pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/6 "2019-01-09T12:08:41Z")

</div>

Sorry for the bump but any opinion on the above please 🙂

---

<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:** [January 9, 2019, 12:17pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/7 "2019-01-09T12:17:19Z")

</div>

How are your nodes configured? can you share the config of two nodes running on the same host?

---

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [January 9, 2019, 12:27pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/8 "2019-01-09T12:27:42Z")

</div>

Thanks for the reply Chris,

Below is the config for all the data nodes where I tested for the behaviour.

```
bin/elasticsearch
  -E path.logs=/my/path/logs
  -E discovery.zen.minimum_master_nodes=2
  -E bootstrap.system_call_filter=false
  -E node.max_local_storage_nodes=12
  -E node.ingest=true
  -E node.data=true
  -E node.attr.node.type=hot
  -E discovery.zen.ping.unicast.hosts=hostA,hostB,hostC
  -E thread_pool.bulk.queue_size=1500
  -E network.host=0.0.0.0
  -E path.data=/my/path/data/default
  -E cluster.name=my_cluster
  -E xpack.security.enabled=false
  -E node.name=my_node_name_0
  -E node.master=true

```

And the cluster settings are:

```
xpack.monitoring.collection.enabled: true
action.destructive_requires_name: true
cluster.routing.allocation.node_concurrent_recoveries: 50
cluster.routing.allocation.node_initial_primaries_recoveries: 50
script.max_compilations_rate: "200/1m"
```

---

<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:** [January 9, 2019, 12:31pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/9 "2019-01-09T12:31:25Z")

</div>

OK, so nodes on the same physical server use the same IP address but different port numbers? How many master-eligible nodes do you have in the cluster? How many nodes do you run per server?

---

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [January 9, 2019, 12:45pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/10 "2019-01-09T12:45:08Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> so nodes on the same physical server use the same IP address but different port numbers?

This is correct.

> [@Christian\_Dahlqvist](#):
>
> How many master-eligible nodes do you have in the cluster?

This is a test cluster so 3.

> [@Christian\_Dahlqvist](#):
>
> How many nodes do you run per server?

For this particular test cluster it is set up as below.

```
  hostA: 1 default, 1 data, 1 coordinator
  hostB: 1 default, 1 data, 1 coordinator
  hostC: 1 default, 1 coordinator

```

---

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [January 9, 2019, 5:34pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/11 "2019-01-09T17:34:36Z")

</div>

> [@ld\_pvl](#):
>
> If I wanted to force same shards living on the same physical server to get relocated to a different physical server - how can I do that?

I was playing around just now and looks like one way to force the relocation is to close and re-open the index.

So I think just setting [cluster.routing.allocation.same\_shard.host](https://www.elastic.co/guide/en/elasticsearch/reference/current/shards-allocation.html) would be sufficient and I would not need to add an extra shard awareness setting. For newly created indexes I would not need to do anything but for existing indexes I would need to close and re-open them.

Does the above sound ok guys? Is there a better trick than closing re-opening the index?

---

<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:** [February 6, 2019, 5:43pm UTC](https://discuss.elastic.co/t/es-6-5-2-shards-on-the-same-physical-server-do-not-automatically-relocate-to-another-server-after-cluster-routing-allocation-same-shard-host-is-set-to-true/161543/12 "2019-02-06T17:43:38Z")

</div>

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