# Correct Index balancing between 2 different datacenter

**URL:** <https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406>\
**Category:** Elasticsearch\
**Created:** [February 5, 2021, 2:37pm UTC](https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406 "2021-02-05T14:37:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [February 5, 2021, 2:37pm UTC](https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406/1 "2021-02-05T14:37:55Z")

</div>

hi there,  
this is my current scenario:

5 nodes (n1-n2-n3-n4-n5)  
1 index with 3 shards and 1 replica  
2 datacenter (n1 in DC1, n2 in DC2, n3 in DC1, n4 in DC2, n5 in DC1)

shard0 is on n1 and n5 (so in DC1)  
shard1 is on n2 and n4 (so in DC2)  
shard2 is on n3 and n1

In this situation, if Datacenter1 will go down I will not be able to use that index.  
is there a way to avoid this situation? obviously, Elasticsearch could not know the datacenter position of every node but could I assign them an attribute and then balance the shards?

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [February 10, 2021, 8:20pm UTC](https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406/2 "2021-02-10T20:20:27Z")

</div>

I was thinking, is there a way to link every odd shard to the odd nodes (n1, n3...) and the same for the even shards?

---

<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:** [February 10, 2021, 9:13pm UTC](https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406/3 "2021-02-10T21:13:57Z")

</div>

How close are these datacenters to each other?

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [February 10, 2021, 10:36pm UTC](https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406/4 "2021-02-10T22:36:32Z")

</div>

40/50 km. Curious to know how this detail could change it

---

<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:** [February 10, 2021, 10:50pm UTC](https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406/5 "2021-02-10T22:50:26Z")

</div>

Elasticsearch is not designed (or supported) to be operated over geographically diverse networks.

[Resilience in larger clusters | Elasticsearch Reference [7.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/high-availability-cluster-design-large-clusters.html) might be a good place to start with some of the concepts and ideas.

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [February 11, 2021, 7:41am UTC](https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406/6 "2021-02-11T07:41:46Z")

</div>

I'm already using attributes to isolate data nodes for different services purpose so probably I have to use one or more additional attribute to limitate any data loss due to geographic separation.

---

<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:** [March 11, 2021, 7:42am UTC](https://discuss.elastic.co/t/correct-index-balancing-between-2-different-datacenter/263406/7 "2021-03-11T07:42:46Z")

</div>

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