# Question about elasticsearch shard zone

**URL:** <https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441>\
**Category:** Elasticsearch\
**Created:** [October 23, 2012, 1:05am UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441 "2012-10-23T01:05:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![tt1](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@tt1](https://discuss.elastic.co/u/tt1)\
**Post date:** [October 23, 2012, 1:05am UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/1 "2012-10-23T01:05:04Z")

</div>

Hi there,

I'm trying to shard the elasticsearch cluster, and I came across this  
documentation:  
[http://www.elasticsearch.org/guide/reference/modules/cluster.html](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
I understand most of the explanation, the example is saying 2 nodes per  
rack\_id, I wonder if we can use 1 node per rack\_id? Basically I want to  
avoid confusion in the setup, basically each node.rack\_id will represent  
one node instead of one rack(or a set of server).  
What do you think?

Thanks,  
Terence

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [October 23, 2012, 7:21am UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/2 "2012-10-23T07:21:06Z")

</div>

Hello Terence,

Let me see if I understood your question correctly: you want to set  
one rack ID per node, to make sure that a shard and its replica won't  
end up on the same node. While that should be possible, you shouldn't  
have to do anything in order to achieve the desired result.

My understanding of the default behavior is the following: if a shard  
is allocated to a node, ES will look for other nodes to assign the  
next unassigned replica. If no nodes are available, the replica will  
remain unassigned (cluster state yellow). Attributes like rack\_id  
would come into play when you want to make sure a shard and its  
replica don't rely on the same group of servers (rack, zone, etc) - so  
in case the whole group goes down you still have a working copy of  
your data.

If I didn't understand your question correctly, can you please rephrase it?

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Tue, Oct 23, 2012 at 4:05 AM, tt [tt@thebackplane.com](mailto:tt@thebackplane.com) wrote:

> Hi there,
> 
> I'm trying to shard the elasticsearch cluster, and I came across this  
> documentation:  
> [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> I understand most of the explanation, the example is saying 2 nodes per  
> rack\_id, I wonder if we can use 1 node per rack\_id? Basically I want to  
> avoid confusion in the setup, basically each node.rack\_id will represent one  
> node instead of one rack(or a set of server).  
> What do you think?
> 
> Thanks,  
> Terence

--

---

<div class="post-metadata">

**Author:** ![tt1](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@tt1](https://discuss.elastic.co/u/tt1)\
**Post date:** [October 23, 2012, 9:47pm UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/3 "2012-10-23T21:47:56Z")

</div>

Hi Radu,

The reason I want to set one node per rack/zone because adding a new layer  
of rack/zone could be confusing when you manage it. If I set one node per  
rack/zone, then I only need to worry about shard and replica per index.  
Does it make sense?

Thanks,  
Terence

On Tuesday, October 23, 2012 12:21:09 AM UTC-7, Radu Gheorghe wrote:

> Hello Terence,
> 
> Let me see if I understood your question correctly: you want to set  
> one rack ID per node, to make sure that a shard and its replica won't  
> end up on the same node. While that should be possible, you shouldn't  
> have to do anything in order to achieve the desired result.
> 
> My understanding of the default behavior is the following: if a shard  
> is allocated to a node, ES will look for other nodes to assign the  
> next unassigned replica. If no nodes are available, the replica will  
> remain unassigned (cluster state yellow). Attributes like rack\_id  
> would come into play when you want to make sure a shard and its  
> replica don't rely on the same group of servers (rack, zone, etc) - so  
> in case the whole group goes down you still have a working copy of  
> your data.
> 
> If I didn't understand your question correctly, can you please rephrase  
> it?
> 
> ## Best regards, Radu
> 
> [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> 
> On Tue, Oct 23, 2012 at 4:05 AM, tt \<[t...@thebackplane.com](mailto:t...@thebackplane.com) \<javascript:\>\>  
> wrote:
> 
> > Hi there,
> > 
> > I'm trying to shard the elasticsearch cluster, and I came across this  
> > documentation:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> > I understand most of the explanation, the example is saying 2 nodes per  
> > rack\_id, I wonder if we can use 1 node per rack\_id? Basically I want to  
> > avoid confusion in the setup, basically each node.rack\_id will represent  
> > one  
> > node instead of one rack(or a set of server).  
> > What do you think?
> > 
> > Thanks,  
> > Terence

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [October 24, 2012, 6:23am UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/4 "2012-10-24T06:23:46Z")

</div>

Hello Terrance,

On Wed, Oct 24, 2012 at 12:47 AM, tt [tt@thebackplane.com](mailto:tt@thebackplane.com) wrote:

> Hi Radu,
> 
> The reason I want to set one node per rack/zone because adding a new layer  
> of rack/zone could be confusing when you manage it. If I set one node per  
> rack/zone, then I only need to worry about shard and replica per index. Does  
> it make sense?

No, not really. Maybe it's just me ☹

What exactly are you trying to achieve here? To make sure that a shard  
and its replica don't end up on the same node, or... ?

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

> Thanks,  
> Terence
> 
> On Tuesday, October 23, 2012 12:21:09 AM UTC-7, Radu Gheorghe wrote:
> 
> > Hello Terence,
> > 
> > Let me see if I understood your question correctly: you want to set  
> > one rack ID per node, to make sure that a shard and its replica won't  
> > end up on the same node. While that should be possible, you shouldn't  
> > have to do anything in order to achieve the desired result.
> > 
> > My understanding of the default behavior is the following: if a shard  
> > is allocated to a node, ES will look for other nodes to assign the  
> > next unassigned replica. If no nodes are available, the replica will  
> > remain unassigned (cluster state yellow). Attributes like rack\_id  
> > would come into play when you want to make sure a shard and its  
> > replica don't rely on the same group of servers (rack, zone, etc) - so  
> > in case the whole group goes down you still have a working copy of  
> > your data.
> > 
> > If I didn't understand your question correctly, can you please rephrase  
> > it?
> > 
> > ## Best regards, Radu
> > 
> > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > 
> > On Tue, Oct 23, 2012 at 4:05 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > 
> > > Hi there,
> > > 
> > > I'm trying to shard the elasticsearch cluster, and I came across this  
> > > documentation:  
> > > [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> > > I understand most of the explanation, the example is saying 2 nodes per  
> > > rack\_id, I wonder if we can use 1 node per rack\_id? Basically I want to  
> > > avoid confusion in the setup, basically each node.rack\_id will represent  
> > > one  
> > > node instead of one rack(or a set of server).  
> > > What do you think?
> > > 
> > > Thanks,  
> > > Terence
> 
> --

--

---

<div class="post-metadata">

**Author:** ![tt1](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@tt1](https://discuss.elastic.co/u/tt1)\
**Post date:** [October 24, 2012, 6:16pm UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/5 "2012-10-24T18:16:54Z")

</div>

Hi Radu,

I'm trying to set a distributed ES shard cluster that can provide data  
redundancy and improve read+write performance. Maybe I should ask the  
following question:

What is the difference between (10 shards + 2 replicas with total 2 rack\_id  
and 10 nodes per rack\_id) VS (10 shards + 2 replicas with total 20 rack\_id  
and 1 node per rack\_id)?

Either solution will consume 20 nodes, my original question was leaning  
toward the latter solution, but before I start implementing it, I would  
like to understand the difference between the two.

Thanks for your help,  
Terence

On Tuesday, October 23, 2012 11:23:49 PM UTC-7, Radu Gheorghe wrote:

> Hello Terrance,
> 
> On Wed, Oct 24, 2012 at 12:47 AM, tt \<[t...@thebackplane.com](mailto:t...@thebackplane.com) \<javascript:\>\>  
> wrote:
> 
> > Hi Radu,
> > 
> > The reason I want to set one node per rack/zone because adding a new  
> > layer  
> > of rack/zone could be confusing when you manage it. If I set one node  
> > per  
> > rack/zone, then I only need to worry about shard and replica per index.  
> > Does  
> > it make sense?
> 
> No, not really. Maybe it's just me ☹
> 
> What exactly are you trying to achieve here? To make sure that a shard  
> and its replica don't end up on the same node, or... ?
> 
> ## Best regards, Radu
> 
> [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> 
> > Thanks,  
> > Terence
> > 
> > On Tuesday, October 23, 2012 12:21:09 AM UTC-7, Radu Gheorghe wrote:
> > 
> > > Hello Terence,
> > > 
> > > Let me see if I understood your question correctly: you want to set  
> > > one rack ID per node, to make sure that a shard and its replica won't  
> > > end up on the same node. While that should be possible, you shouldn't  
> > > have to do anything in order to achieve the desired result.
> > > 
> > > My understanding of the default behavior is the following: if a shard  
> > > is allocated to a node, ES will look for other nodes to assign the  
> > > next unassigned replica. If no nodes are available, the replica will  
> > > remain unassigned (cluster state yellow). Attributes like rack\_id  
> > > would come into play when you want to make sure a shard and its  
> > > replica don't rely on the same group of servers (rack, zone, etc) - so  
> > > in case the whole group goes down you still have a working copy of  
> > > your data.
> > > 
> > > If I didn't understand your question correctly, can you please rephrase  
> > > it?
> > > 
> > > ## Best regards, Radu
> > > 
> > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > 
> > > On Tue, Oct 23, 2012 at 4:05 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > > 
> > > > Hi there,
> > > > 
> > > > I'm trying to shard the elasticsearch cluster, and I came across this  
> > > > documentation:  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> > > > I understand most of the explanation, the example is saying 2 nodes  
> > > > per  
> > > > rack\_id, I wonder if we can use 1 node per rack\_id? Basically I want  
> > > > to  
> > > > avoid confusion in the setup, basically each node.rack\_id will  
> > > > represent  
> > > > one  
> > > > node instead of one rack(or a set of server).  
> > > > What do you think?
> > > > 
> > > > Thanks,  
> > > > Terence
> > 
> > --

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [October 24, 2012, 6:34pm UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/6 "2012-10-24T18:34:43Z")

</div>

Hello Terence,

Please note that 10 shards + 2 replicas per shard will get you a total  
of 30 shards. To get 20, you need 1 replica per shard.

Back to your question, assuming that you got 20 nodes and 20 total  
shards, the configuration with 20 rack\_ids would be the same as one  
with no rack\_ids at all: one shard per node, and each shard might end  
up on each node.

If you have 2 rack\_ids, your primary shards will be on the nodes on  
one rack, and your replicas will be on the other rack.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Wed, Oct 24, 2012 at 9:16 PM, tt [tt@thebackplane.com](mailto:tt@thebackplane.com) wrote:

> Hi Radu,
> 
> I'm trying to set a distributed ES shard cluster that can provide data  
> redundancy and improve read+write performance. Maybe I should ask the  
> following question:
> 
> What is the difference between (10 shards + 2 replicas with total 2 rack\_id  
> and 10 nodes per rack\_id) VS (10 shards + 2 replicas with total 20 rack\_id  
> and 1 node per rack\_id)?
> 
> Either solution will consume 20 nodes, my original question was leaning  
> toward the latter solution, but before I start implementing it, I would like  
> to understand the difference between the two.
> 
> Thanks for your help,  
> Terence
> 
> On Tuesday, October 23, 2012 11:23:49 PM UTC-7, Radu Gheorghe wrote:
> 
> > Hello Terrance,
> > 
> > On Wed, Oct 24, 2012 at 12:47 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > 
> > > Hi Radu,
> > > 
> > > The reason I want to set one node per rack/zone because adding a new  
> > > layer  
> > > of rack/zone could be confusing when you manage it. If I set one node  
> > > per  
> > > rack/zone, then I only need to worry about shard and replica per index.  
> > > Does  
> > > it make sense?
> > 
> > No, not really. Maybe it's just me ☹
> > 
> > What exactly are you trying to achieve here? To make sure that a shard  
> > and its replica don't end up on the same node, or... ?
> > 
> > ## Best regards, Radu
> > 
> > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > 
> > > Thanks,  
> > > Terence
> > > 
> > > On Tuesday, October 23, 2012 12:21:09 AM UTC-7, Radu Gheorghe wrote:
> > > 
> > > > Hello Terence,
> > > > 
> > > > Let me see if I understood your question correctly: you want to set  
> > > > one rack ID per node, to make sure that a shard and its replica won't  
> > > > end up on the same node. While that should be possible, you shouldn't  
> > > > have to do anything in order to achieve the desired result.
> > > > 
> > > > My understanding of the default behavior is the following: if a shard  
> > > > is allocated to a node, ES will look for other nodes to assign the  
> > > > next unassigned replica. If no nodes are available, the replica will  
> > > > remain unassigned (cluster state yellow). Attributes like rack\_id  
> > > > would come into play when you want to make sure a shard and its  
> > > > replica don't rely on the same group of servers (rack, zone, etc) - so  
> > > > in case the whole group goes down you still have a working copy of  
> > > > your data.
> > > > 
> > > > If I didn't understand your question correctly, can you please rephrase  
> > > > it?
> > > > 
> > > > ## Best regards, Radu
> > > > 
> > > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > > 
> > > > On Tue, Oct 23, 2012 at 4:05 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > > > 
> > > > > Hi there,
> > > > > 
> > > > > I'm trying to shard the elasticsearch cluster, and I came across this  
> > > > > documentation:  
> > > > > [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> > > > > I understand most of the explanation, the example is saying 2 nodes  
> > > > > per  
> > > > > rack\_id, I wonder if we can use 1 node per rack\_id? Basically I want  
> > > > > to  
> > > > > avoid confusion in the setup, basically each node.rack\_id will  
> > > > > represent  
> > > > > one  
> > > > > node instead of one rack(or a set of server).  
> > > > > What do you think?
> > > > > 
> > > > > Thanks,  
> > > > > Terence
> > > 
> > > --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![tt1](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@tt1](https://discuss.elastic.co/u/tt1)\
**Post date:** [October 24, 2012, 6:41pm UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/7 "2012-10-24T18:41:06Z")

</div>

Sorry, I actually mean 1 replica per shard. Thanks for the correction.

So my question is what is the benefit for using rack\_ids since I can  
already distribute the shard across all 20 nodes without using rack\_id?

Thanks,  
Terence

On Wednesday, October 24, 2012 11:34:48 AM UTC-7, Radu Gheorghe wrote:

> Hello Terence,
> 
> Please note that 10 shards + 2 replicas per shard will get you a total  
> of 30 shards. To get 20, you need 1 replica per shard.
> 
> Back to your question, assuming that you got 20 nodes and 20 total  
> shards, the configuration with 20 rack\_ids would be the same as one  
> with no rack\_ids at all: one shard per node, and each shard might end  
> up on each node.
> 
> If you have 2 rack\_ids, your primary shards will be on the nodes on  
> one rack, and your replicas will be on the other rack.
> 
> ## Best regards, Radu
> 
> [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> 
> On Wed, Oct 24, 2012 at 9:16 PM, tt \<[t...@thebackplane.com](mailto:t...@thebackplane.com) \<javascript:\>\>  
> wrote:
> 
> > Hi Radu,
> > 
> > I'm trying to set a distributed ES shard cluster that can provide data  
> > redundancy and improve read+write performance. Maybe I should ask the  
> > following question:
> > 
> > What is the difference between (10 shards + 2 replicas with total 2  
> > rack\_id  
> > and 10 nodes per rack\_id) VS (10 shards + 2 replicas with total 20  
> > rack\_id  
> > and 1 node per rack\_id)?
> > 
> > Either solution will consume 20 nodes, my original question was leaning  
> > toward the latter solution, but before I start implementing it, I would  
> > like  
> > to understand the difference between the two.
> > 
> > Thanks for your help,  
> > Terence
> > 
> > On Tuesday, October 23, 2012 11:23:49 PM UTC-7, Radu Gheorghe wrote:
> > 
> > > Hello Terrance,
> > > 
> > > On Wed, Oct 24, 2012 at 12:47 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > > 
> > > > Hi Radu,
> > > > 
> > > > The reason I want to set one node per rack/zone because adding a new  
> > > > layer  
> > > > of rack/zone could be confusing when you manage it. If I set one node  
> > > > per  
> > > > rack/zone, then I only need to worry about shard and replica per  
> > > > index.  
> > > > Does  
> > > > it make sense?
> > > 
> > > No, not really. Maybe it's just me ☹
> > > 
> > > What exactly are you trying to achieve here? To make sure that a shard  
> > > and its replica don't end up on the same node, or... ?
> > > 
> > > ## Best regards, Radu
> > > 
> > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > 
> > > > Thanks,  
> > > > Terence
> > > > 
> > > > On Tuesday, October 23, 2012 12:21:09 AM UTC-7, Radu Gheorghe wrote:
> > > > 
> > > > > Hello Terence,
> > > > > 
> > > > > Let me see if I understood your question correctly: you want to set  
> > > > > one rack ID per node, to make sure that a shard and its replica  
> > > > > won't  
> > > > > end up on the same node. While that should be possible, you  
> > > > > shouldn't  
> > > > > have to do anything in order to achieve the desired result.
> > > > > 
> > > > > My understanding of the default behavior is the following: if a  
> > > > > shard  
> > > > > is allocated to a node, ES will look for other nodes to assign the  
> > > > > next unassigned replica. If no nodes are available, the replica will  
> > > > > remain unassigned (cluster state yellow). Attributes like rack\_id  
> > > > > would come into play when you want to make sure a shard and its  
> > > > > replica don't rely on the same group of servers (rack, zone, etc) -  
> > > > > so  
> > > > > in case the whole group goes down you still have a working copy of  
> > > > > your data.
> > > > > 
> > > > > If I didn't understand your question correctly, can you please  
> > > > > rephrase  
> > > > > it?
> > > > > 
> > > > > ## Best regards, Radu
> > > > > 
> > > > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > > > 
> > > > > On Tue, Oct 23, 2012 at 4:05 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > > > > 
> > > > > > Hi there,
> > > > > > 
> > > > > > I'm trying to shard the elasticsearch cluster, and I came across  
> > > > > > this  
> > > > > > documentation:  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> > > > > > I understand most of the explanation, the example is saying 2  
> > > > > > nodes  
> > > > > > per  
> > > > > > rack\_id, I wonder if we can use 1 node per rack\_id? Basically I  
> > > > > > want  
> > > > > > to  
> > > > > > avoid confusion in the setup, basically each node.rack\_id will  
> > > > > > represent  
> > > > > > one  
> > > > > > node instead of one rack(or a set of server).  
> > > > > > What do you think?
> > > > > > 
> > > > > > Thanks,  
> > > > > > Terence
> > > > 
> > > > --
> > 
> > --

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [October 24, 2012, 8:16pm UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/8 "2012-10-24T20:16:27Z")

</div>

Hello Terence,

If you only do that, there's no benefit. It only make sense to use  
such IDs when you want to separate groups of nodes. Individual nodes  
are already separated, in Elasticsearch's view. That's why, for  
example when you start ES with one index in the default configuration  
(5 shards, 1 replica) - replicas are not allocated. Because it doesn't  
make sense to have a shard and its replica on the same node.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Wed, Oct 24, 2012 at 9:41 PM, tt [tt@thebackplane.com](mailto:tt@thebackplane.com) wrote:

> Sorry, I actually mean 1 replica per shard. Thanks for the correction.
> 
> So my question is what is the benefit for using rack\_ids since I can already  
> distribute the shard across all 20 nodes without using rack\_id?
> 
> Thanks,  
> Terence
> 
> On Wednesday, October 24, 2012 11:34:48 AM UTC-7, Radu Gheorghe wrote:
> 
> > Hello Terence,
> > 
> > Please note that 10 shards + 2 replicas per shard will get you a total  
> > of 30 shards. To get 20, you need 1 replica per shard.
> > 
> > Back to your question, assuming that you got 20 nodes and 20 total  
> > shards, the configuration with 20 rack\_ids would be the same as one  
> > with no rack\_ids at all: one shard per node, and each shard might end  
> > up on each node.
> > 
> > If you have 2 rack\_ids, your primary shards will be on the nodes on  
> > one rack, and your replicas will be on the other rack.
> > 
> > ## Best regards, Radu
> > 
> > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > 
> > On Wed, Oct 24, 2012 at 9:16 PM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > 
> > > Hi Radu,
> > > 
> > > I'm trying to set a distributed ES shard cluster that can provide data  
> > > redundancy and improve read+write performance. Maybe I should ask the  
> > > following question:
> > > 
> > > What is the difference between (10 shards + 2 replicas with total 2  
> > > rack\_id  
> > > and 10 nodes per rack\_id) VS (10 shards + 2 replicas with total 20  
> > > rack\_id  
> > > and 1 node per rack\_id)?
> > > 
> > > Either solution will consume 20 nodes, my original question was leaning  
> > > toward the latter solution, but before I start implementing it, I would  
> > > like  
> > > to understand the difference between the two.
> > > 
> > > Thanks for your help,  
> > > Terence
> > > 
> > > On Tuesday, October 23, 2012 11:23:49 PM UTC-7, Radu Gheorghe wrote:
> > > 
> > > > Hello Terrance,
> > > > 
> > > > On Wed, Oct 24, 2012 at 12:47 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > > > 
> > > > > Hi Radu,
> > > > > 
> > > > > The reason I want to set one node per rack/zone because adding a new  
> > > > > layer  
> > > > > of rack/zone could be confusing when you manage it. If I set one node  
> > > > > per  
> > > > > rack/zone, then I only need to worry about shard and replica per  
> > > > > index.  
> > > > > Does  
> > > > > it make sense?
> > > > 
> > > > No, not really. Maybe it's just me ☹
> > > > 
> > > > What exactly are you trying to achieve here? To make sure that a shard  
> > > > and its replica don't end up on the same node, or... ?
> > > > 
> > > > ## Best regards, Radu
> > > > 
> > > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > > 
> > > > > Thanks,  
> > > > > Terence
> > > > > 
> > > > > On Tuesday, October 23, 2012 12:21:09 AM UTC-7, Radu Gheorghe wrote:
> > > > > 
> > > > > > Hello Terence,
> > > > > > 
> > > > > > Let me see if I understood your question correctly: you want to set  
> > > > > > one rack ID per node, to make sure that a shard and its replica  
> > > > > > won't  
> > > > > > end up on the same node. While that should be possible, you  
> > > > > > shouldn't  
> > > > > > have to do anything in order to achieve the desired result.
> > > > > > 
> > > > > > My understanding of the default behavior is the following: if a  
> > > > > > shard  
> > > > > > is allocated to a node, ES will look for other nodes to assign the  
> > > > > > next unassigned replica. If no nodes are available, the replica will  
> > > > > > remain unassigned (cluster state yellow). Attributes like rack\_id  
> > > > > > would come into play when you want to make sure a shard and its  
> > > > > > replica don't rely on the same group of servers (rack, zone, etc) -  
> > > > > > so  
> > > > > > in case the whole group goes down you still have a working copy of  
> > > > > > your data.
> > > > > > 
> > > > > > If I didn't understand your question correctly, can you please  
> > > > > > rephrase  
> > > > > > it?
> > > > > > 
> > > > > > ## Best regards, Radu
> > > > > > 
> > > > > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > > > > 
> > > > > > On Tue, Oct 23, 2012 at 4:05 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > > > > > 
> > > > > > > Hi there,
> > > > > > > 
> > > > > > > I'm trying to shard the elasticsearch cluster, and I came across  
> > > > > > > this  
> > > > > > > documentation:  
> > > > > > > [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)  
> > > > > > > I understand most of the explanation, the example is saying 2  
> > > > > > > nodes  
> > > > > > > per  
> > > > > > > rack\_id, I wonder if we can use 1 node per rack\_id? Basically I  
> > > > > > > want  
> > > > > > > to  
> > > > > > > avoid confusion in the setup, basically each node.rack\_id will  
> > > > > > > represent  
> > > > > > > one  
> > > > > > > node instead of one rack(or a set of server).  
> > > > > > > What do you think?
> > > > > > > 
> > > > > > > Thanks,  
> > > > > > > Terence
> > > > > 
> > > > > --
> > > 
> > > --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![tt1](https://avatars.discourse-cdn.com/v4/letter/t/6de8d8/32.png) [@tt1](https://discuss.elastic.co/u/tt1)\
**Post date:** [October 26, 2012, 7:23pm UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/9 "2012-10-26T19:23:29Z")

</div>

Hi Radu,

I got it working now. Thanks for your help!

Terence

On Wednesday, October 24, 2012 1:16:31 PM UTC-7, Radu Gheorghe wrote:

> Hello Terence,
> 
> If you only do that, there's no benefit. It only make sense to use  
> such IDs when you want to separate groups of nodes. Individual nodes  
> are already separated, in Elasticsearch's view. That's why, for  
> example when you start ES with one index in the default configuration  
> (5 shards, 1 replica) - replicas are not allocated. Because it doesn't  
> make sense to have a shard and its replica on the same node.
> 
> ## Best regards, Radu
> 
> [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> 
> On Wed, Oct 24, 2012 at 9:41 PM, tt \<[t...@thebackplane.com](mailto:t...@thebackplane.com) \<javascript:\>\>  
> wrote:
> 
> > Sorry, I actually mean 1 replica per shard. Thanks for the correction.
> > 
> > So my question is what is the benefit for using rack\_ids since I can  
> > already  
> > distribute the shard across all 20 nodes without using rack\_id?
> > 
> > Thanks,  
> > Terence
> > 
> > On Wednesday, October 24, 2012 11:34:48 AM UTC-7, Radu Gheorghe wrote:
> > 
> > > Hello Terence,
> > > 
> > > Please note that 10 shards + 2 replicas per shard will get you a total  
> > > of 30 shards. To get 20, you need 1 replica per shard.
> > > 
> > > Back to your question, assuming that you got 20 nodes and 20 total  
> > > shards, the configuration with 20 rack\_ids would be the same as one  
> > > with no rack\_ids at all: one shard per node, and each shard might end  
> > > up on each node.
> > > 
> > > If you have 2 rack\_ids, your primary shards will be on the nodes on  
> > > one rack, and your replicas will be on the other rack.
> > > 
> > > ## Best regards, Radu
> > > 
> > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > 
> > > On Wed, Oct 24, 2012 at 9:16 PM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > > 
> > > > Hi Radu,
> > > > 
> > > > I'm trying to set a distributed ES shard cluster that can provide  
> > > > data  
> > > > redundancy and improve read+write performance. Maybe I should ask the  
> > > > following question:
> > > > 
> > > > What is the difference between (10 shards + 2 replicas with total 2  
> > > > rack\_id  
> > > > and 10 nodes per rack\_id) VS (10 shards + 2 replicas with total 20  
> > > > rack\_id  
> > > > and 1 node per rack\_id)?
> > > > 
> > > > Either solution will consume 20 nodes, my original question was  
> > > > leaning  
> > > > toward the latter solution, but before I start implementing it, I  
> > > > would  
> > > > like  
> > > > to understand the difference between the two.
> > > > 
> > > > Thanks for your help,  
> > > > Terence
> > > > 
> > > > On Tuesday, October 23, 2012 11:23:49 PM UTC-7, Radu Gheorghe wrote:
> > > > 
> > > > > Hello Terrance,
> > > > > 
> > > > > On Wed, Oct 24, 2012 at 12:47 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com) wrote:
> > > > > 
> > > > > > Hi Radu,
> > > > > > 
> > > > > > The reason I want to set one node per rack/zone because adding a  
> > > > > > new  
> > > > > > layer  
> > > > > > of rack/zone could be confusing when you manage it. If I set one  
> > > > > > node  
> > > > > > per  
> > > > > > rack/zone, then I only need to worry about shard and replica per  
> > > > > > index.  
> > > > > > Does  
> > > > > > it make sense?
> > > > > 
> > > > > No, not really. Maybe it's just me ☹
> > > > > 
> > > > > What exactly are you trying to achieve here? To make sure that a  
> > > > > shard  
> > > > > and its replica don't end up on the same node, or... ?
> > > > > 
> > > > > ## Best regards, Radu
> > > > > 
> > > > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > > > 
> > > > > > Thanks,  
> > > > > > Terence
> > > > > > 
> > > > > > On Tuesday, October 23, 2012 12:21:09 AM UTC-7, Radu Gheorghe  
> > > > > > wrote:
> > > > > > 
> > > > > > > Hello Terence,
> > > > > > > 
> > > > > > > Let me see if I understood your question correctly: you want to  
> > > > > > > set  
> > > > > > > one rack ID per node, to make sure that a shard and its replica  
> > > > > > > won't  
> > > > > > > end up on the same node. While that should be possible, you  
> > > > > > > shouldn't  
> > > > > > > have to do anything in order to achieve the desired result.
> > > > > > > 
> > > > > > > My understanding of the default behavior is the following: if a  
> > > > > > > shard  
> > > > > > > is allocated to a node, ES will look for other nodes to assign  
> > > > > > > the  
> > > > > > > next unassigned replica. If no nodes are available, the replica  
> > > > > > > will  
> > > > > > > remain unassigned (cluster state yellow). Attributes like rack\_id  
> > > > > > > would come into play when you want to make sure a shard and its  
> > > > > > > replica don't rely on the same group of servers (rack, zone, etc)
> 
> - 
> 
> > > > > > > so  
> > > > > > > in case the whole group goes down you still have a working copy  
> > > > > > > of  
> > > > > > > your data.
> > > > > > > 
> > > > > > > If I didn't understand your question correctly, can you please  
> > > > > > > rephrase  
> > > > > > > it?
> > > > > > > 
> > > > > > > ## Best regards, Radu
> > > > > > > 
> > > > > > > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > > > > > > 
> > > > > > > On Tue, Oct 23, 2012 at 4:05 AM, tt [t...@thebackplane.com](mailto:t...@thebackplane.com)  
> > > > > > > wrote:
> > > > > > > 
> > > > > > > > Hi there,
> > > > > > > > 
> > > > > > > > I'm trying to shard the elasticsearch cluster, and I came  
> > > > > > > > across  
> > > > > > > > this  
> > > > > > > > documentation:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/modules/cluster.html)
> 
> > > > > > > > I understand most of the explanation, the example is saying 2  
> > > > > > > > nodes  
> > > > > > > > per  
> > > > > > > > rack\_id, I wonder if we can use 1 node per rack\_id? Basically I  
> > > > > > > > want  
> > > > > > > > to  
> > > > > > > > avoid confusion in the setup, basically each node.rack\_id will  
> > > > > > > > represent  
> > > > > > > > one  
> > > > > > > > node instead of one rack(or a set of server).  
> > > > > > > > What do you think?
> > > > > > > > 
> > > > > > > > Thanks,  
> > > > > > > > Terence
> > > > > > 
> > > > > > --
> > > > 
> > > > --
> > 
> > --

--

---

<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 6, 2017, 3:07am UTC](https://discuss.elastic.co/t/question-about-elasticsearch-shard-zone/9441/10 "2017-07-06T03:07:03Z")

</div>


