Correct Index balancing between 2 different datacenter

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?

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?

How close are these datacenters to each other?

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

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

Resilience in larger clusters | Elasticsearch Reference [7.11] | Elastic might be a good place to start with some of the concepts and ideas.

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.

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