# total\_shards\_per\_node and node failure

**URL:** <https://discuss.elastic.co/t/total-shards-per-node-and-node-failure/9943>\
**Category:** Elasticsearch\
**Created:** [December 5, 2012, 2:14am UTC](https://discuss.elastic.co/t/total-shards-per-node-and-node-failure/9943 "2012-12-05T02:14:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Rick](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@Jeff\_Rick](https://discuss.elastic.co/u/Jeff_Rick)\
**Post date:** [December 5, 2012, 2:14am UTC](https://discuss.elastic.co/t/total-shards-per-node-and-node-failure/9943/1 "2012-12-05T02:14:27Z")

</div>

Hi,

Had a question on the setting "total\_shards\_per\_node". If I set an index up  
to have:

-- shards = # of nodes in my cluster  
-- total\_shards\_per\_node of 2  
-- replicas set to 1

Then I would get an even distribution of shards and replicas across my  
cluster, make sense. The question is what happens if I have a node failure?  
Does the cluster fail to allocate new replicas for the shards that were on  
the failed node? Does that mean I have potential data loss if any two nodes  
fail, no matter the size of the cluster?

I did some digging in the code and that seems to be the case but wanted to  
confirm I haven't missed anything.

Thanks

--  
View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/total-shards-per-node-and-node-failure-tp4026488.html](http://elasticsearch-users.115913.n3.nabble.com/total-shards-per-node-and-node-failure-tp4026488.html)  
Sent from the ElasticSearch Users mailing list archive at [Nabble.com](http://Nabble.com).

--

---

<div class="post-metadata">

**Author:** ![Chuck\_McKenzie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chuck_mckenzie/32/19660_2.png) [@Chuck\_McKenzie](https://discuss.elastic.co/u/Chuck_McKenzie)\
**Post date:** [December 10, 2012, 4:26am UTC](https://discuss.elastic.co/t/total-shards-per-node-and-node-failure/9943/2 "2012-12-10T04:26:46Z")

</div>

That is the case, afaik - we always try to have a little spare capacity by  
setting number of indices to n-(1 or 2), so we can quickly reestablish  
redundancy when we lose a node. Rack awareness can also help with this a  
little.

On Tuesday, December 4, 2012 8:14:27 PM UTC-6, Jeff Rick wrote:

> Hi,
> 
> Had a question on the setting "total\_shards\_per\_node". If I set an index  
> up  
> to have:
> 
> -- shards = # of nodes in my cluster  
> -- total\_shards\_per\_node of 2  
> -- replicas set to 1
> 
> Then I would get an even distribution of shards and replicas across my  
> cluster, make sense. The question is what happens if I have a node  
> failure?  
> Does the cluster fail to allocate new replicas for the shards that were on  
> the failed node? Does that mean I have potential data loss if any two  
> nodes  
> fail, no matter the size of the cluster?
> 
> I did some digging in the code and that seems to be the case but wanted to  
> confirm I haven't missed anything.
> 
> Thanks
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/total-shards-per-node-and-node-failure-tp4026488.html](http://elasticsearch-users.115913.n3.nabble.com/total-shards-per-node-and-node-failure-tp4026488.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

--

---

<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:00am UTC](https://discuss.elastic.co/t/total-shards-per-node-and-node-failure/9943/3 "2017-07-06T03:00:38Z")

</div>


