# Need help with shard balancing

**URL:** <https://discuss.elastic.co/t/need-help-with-shard-balancing/10639>\
**Category:** Elasticsearch\
**Created:** [February 6, 2013, 4:26pm UTC](https://discuss.elastic.co/t/need-help-with-shard-balancing/10639 "2013-02-06T16:26:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craig\_Brown\_2](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@Craig\_Brown\_2](https://discuss.elastic.co/u/Craig_Brown_2)\
**Post date:** [February 6, 2013, 4:26pm UTC](https://discuss.elastic.co/t/need-help-with-shard-balancing/10639/1 "2013-02-06T16:26:15Z")

</div>

We have a 4-node cluster with 2 indexes each with 1 replica. We are  
currently indexing all documents against a single index, while the other  
one is empty. One of the nodes it doing very little work because it has  
mostly empty shards.

I need a way to have ES distribute the shards from each index evenly across  
all 4 nodes. I know by default, ES considers all shards equally. I've  
looked into some of the ES config settings around shard balancing, but it's  
not obvious how to make this happen.

Any pointers appreciated, thanks!

-Craig

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [February 6, 2013, 4:45pm UTC](https://discuss.elastic.co/t/need-help-with-shard-balancing/10639/2 "2013-02-06T16:45:02Z")

</div>

Hi Craig

On Wed, 2013-02-06 at 08:26 -0800, Craig Brown wrote:

> We have a 4-node cluster with 2 indexes each with 1 replica. We are  
> currently indexing all documents against a single index, while the  
> other one is empty. One of the nodes it doing very little work because  
> it has mostly empty shards.
> 
> I need a way to have ES distribute the shards from each index evenly  
> across all 4 nodes. I know by default, ES considers all shards  
> equally. I've looked into some of the ES config settings around shard  
> balancing, but it's not obvious how to make this happen.

If you're using v0.19.10 or higher, then you can use the cluster reroute  
API to move your shards around:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

If not, and you're not using the other index, try just closing and  
reopening it. If that doesn't work, you may have to delete it

clint

> Any pointers appreciated, thanks!
> 
> -Craig
> 
> --  
> You received this message because you are subscribed to the Google  
> Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send  
> an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![ppearcy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ppearcy/32/980_2.png) [@ppearcy](https://discuss.elastic.co/u/ppearcy)\
**Post date:** [February 6, 2013, 5:03pm UTC](https://discuss.elastic.co/t/need-help-with-shard-balancing/10639/3 "2013-02-06T17:03:37Z")

</div>

The best way to do this is via  
index.routing.allocation.total\_shards\_per\_node:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

I have a process that looks at the number of data nodes I have and the  
number of shards for an index and automatically sets this to force a fairer  
balancing. Would be a nice feature to have in the core elasticsearch,  
though.

Best Regards,  
Paul

On Wednesday, February 6, 2013 9:45:02 AM UTC-7, Clinton Gormley wrote:

> Hi Craig
> 
> On Wed, 2013-02-06 at 08:26 -0800, Craig Brown wrote:
> 
> > We have a 4-node cluster with 2 indexes each with 1 replica. We are  
> > currently indexing all documents against a single index, while the  
> > other one is empty. One of the nodes it doing very little work because  
> > it has mostly empty shards.
> > 
> > I need a way to have ES distribute the shards from each index evenly  
> > across all 4 nodes. I know by default, ES considers all shards  
> > equally. I've looked into some of the ES config settings around shard  
> > balancing, but it's not obvious how to make this happen.
> 
> If you're using v0.19.10 or higher, then you can use the cluster reroute  
> API to move your shards around:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-reroute.html)
> 
> If not, and you're not using the other index, try just closing and  
> reopening it. If that doesn't work, you may have to delete it
> 
> clint
> 
> > Any pointers appreciated, thanks!
> > 
> > -Craig
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send  
> > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Craig\_Brown](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@Craig\_Brown](https://discuss.elastic.co/u/Craig_Brown)\
**Post date:** [February 6, 2013, 5:10pm UTC](https://discuss.elastic.co/t/need-help-with-shard-balancing/10639/4 "2013-02-06T17:10:37Z")

</div>

Thanks. Yes, its a 19.9 cluster.

- Craig

On Wed, Feb 6, 2013 at 10:03 AM, ppearcy [ppearcy@gmail.com](mailto:ppearcy@gmail.com) wrote:

> The best way to do this is via  
> index.routing.allocation.total\_shards\_per\_node:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html)
> 
> I have a process that looks at the number of data nodes I have and the  
> number of shards for an index and automatically sets this to force a fairer  
> balancing. Would be a nice feature to have in the core elasticsearch,  
> though.
> 
> Best Regards,  
> Paul
> 
> On Wednesday, February 6, 2013 9:45:02 AM UTC-7, Clinton Gormley wrote:
> 
> > Hi Craig
> > 
> > On Wed, 2013-02-06 at 08:26 -0800, Craig Brown wrote:
> > 
> > > We have a 4-node cluster with 2 indexes each with 1 replica. We are  
> > > currently indexing all documents against a single index, while the  
> > > other one is empty. One of the nodes it doing very little work because  
> > > it has mostly empty shards.
> > > 
> > > I need a way to have ES distribute the shards from each index evenly  
> > > across all 4 nodes. I know by default, ES considers all shards  
> > > equally. I've looked into some of the ES config settings around shard  
> > > balancing, but it's not obvious how to make this happen.
> > 
> > If you're using v0.19.10 or higher, then you can use the cluster reroute  
> > API to move your shards around:
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/**guide/reference/api/admin-)\*\*  
> > cluster-reroute.html[http://www.elasticsearch.org/guide/reference/api/admin-cluster-reroute.html](http://www.elasticsearch.org/guide/reference/api/admin-cluster-reroute.html)
> > 
> > If not, and you're not using the other index, try just closing and  
> > reopening it. If that doesn't work, you may have to delete it
> > 
> > clint
> > 
> > > Any pointers appreciated, thanks!
> > > 
> > > -Craig
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).  
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > > 
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
…  
CRAIG BROWN  
Search Architect  
youwho, Inc.

[www.youwho.com](http://www.youwho.com)

M: 801.680.7300

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:52am UTC](https://discuss.elastic.co/t/need-help-with-shard-balancing/10639/5 "2017-07-06T02:52:43Z")

</div>


