# Shard allocation seems to put replica shards on same host when using: cluster.routing.allocation.same\_shard.host: true

**URL:** <https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181>\
**Category:** Elasticsearch\
**Created:** [March 11, 2016, 4:25pm UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181 "2016-03-11T16:25:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [March 11, 2016, 4:25pm UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/1 "2016-03-11T16:25:50Z")

</div>

Using 2.2.0

So I decided to put more nodes per physical host. These are not VMs it's 3 physical instances running on the same physical host.

For each host, I have 4 total servers....

I disabled shard allocation downed the host, rebuilt it with 3 instances and brought up the 3 instances, re-enabled shard allocation, rinse and repeat.

It seems some hosts got primary and replicas...

Is the cluster.routing.allocation.same\_shard.host: true enough? I'm pretty sure I have it setup for all instances!

 ![](https://us1.discourse-cdn.com/elastic/original/2X/f/fbdf015ebe19991150c5d2aa52a62b4fa3c7e1ca.jpg)

The new index on the far right seems ok.

---

<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:** [March 12, 2016, 1:45am UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/2 "2016-03-12T01:45:55Z")

</div>

Maybe try an empty reroute request to see if it forces them off the same host?

---

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [March 15, 2016, 8:01pm UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/3 "2016-03-15T20:01:53Z")

</div>

Thanks. I'll check asap.

---

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [March 21, 2016, 3:47pm UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/4 "2016-03-21T15:47:41Z")

</div>

@warkolm

Didn't seem to work.

---

<div class="post-metadata">

**Author:** ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)\
**Post date:** [April 26, 2016, 4:13pm UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/5 "2016-04-26T16:13:25Z")

</div>

Do you running ES on Windows? I'm having the same issue where this setting does not work.

I wonder if ES instances on the same physical server must share the same data path for this setting to work. It's unlikely because the setting use host name to determine if instances are running on the same host.

---

<div class="post-metadata">

**Author:** ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)\
**Post date:** [April 27, 2016, 12:33am UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/6 "2016-04-27T00:33:27Z")

</div>

@warkolm: does this setting work at index creation time only?

---

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [April 28, 2016, 8:05am UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/7 "2016-04-28T08:05:27Z")

</div>

Nope on Linux. I think it's true, creation time shards look good. But on  
rebalance after recovery, some hosts have same shards together...

---

<div class="post-metadata">

**Author:** ![anhlqn](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anhlqn/32/5454_2.png) [@anhlqn](https://discuss.elastic.co/u/anhlqn)\
**Post date:** [April 28, 2016, 2:16pm UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/8 "2016-04-28T14:16:37Z")

</div>

I've tried the Shard Allocation Awareness and it works [https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-awareness.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-awareness.html)

---

<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:** [July 5, 2017, 10:55pm UTC](https://discuss.elastic.co/t/shard-allocation-seems-to-put-replica-shards-on-same-host-when-using-cluster-routing-allocation-same-shard-host-true/44181/9 "2017-07-05T22:55:31Z")

</div>


