Any way to force only primary shards on 1 site/zone?

Hi,
Lets say we have 2 logical sites in a ES cluster. Can we allocate only primary shards on 1 site and only replicas on another ? With the combination of shard awareness I mean..

Thanks..

No, you can only ensure that you have a copy of each in each site.

Hi,
Thanks for the response.

So you are saying we cannot force them each on 1 site and vice versa?
Even these params wont give what I need?

e.g
cluster.routing.allocation.enable
https://www.elastic.co/guide/en/elasticsearch/reference/2.4/shards-allocation.html

You will have a copy of shard 1 on site a and on site b, but unless you manually allocate every shard, it will distribute the primary and replica between both.

Hi, yes i understand that we can have a copy of shard 1 each on different site, but we have no way of knowing when 1 site will hold either the pri or replica.

For the manual allocation part, can you enlighten me for a bit?

Why do you want to do this?

Hi,
We have some application running on a set of machines say in rack 1.
And we wanted these machines to do our puts/indexing(locally) on the same site 1 instead of going to rack 2.
The ES nodes are rack 2 would be only doing get/search requests.

Is this reasonable?

Primaries and replicas mostly do the same work while indexing, so indexing load is likely to be evenly distributed no matter which side the primary is on. One exception is scripted updates, where a bit more work is done on the primary.

Hi,
I thought replicas dont do indexing? they serve only get requests no?

All data has to be indexed into primaries and replicas so all shards do indexing.

1 Like

Hi,
Thanks for the clarification.
So just wanted to understand, by manual method, is this talking about cluster_reroute?

Yes, but Elasticsearch will promote replica shards to primary when necessary, so you can not really control this.

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