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


(Edmund Cheng) #1

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..


(Mark Walkom) #2

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


(Edmund Cheng) #3

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


(Mark Walkom) #4

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.


(Edmund Cheng) #5

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?


(Mark Walkom) #6

Why do you want to do this?


(Edmund Cheng) #7

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?


(Christian Dahlqvist) #8

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.


(Edmund Cheng) #9

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


(Christian Dahlqvist) #10

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


(Edmund Cheng) #11

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


(Christian Dahlqvist) #12

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


(system) #13

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