# Unbalanced cluster with nearly half of the shards allocated to a single node

**URL:** <https://discuss.elastic.co/t/unbalanced-cluster-with-nearly-half-of-the-shards-allocated-to-a-single-node/51448>\
**Category:** Elasticsearch\
**Created:** [May 31, 2016, 3:50pm UTC](https://discuss.elastic.co/t/unbalanced-cluster-with-nearly-half-of-the-shards-allocated-to-a-single-node/51448 "2016-05-31T15:50:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wagqighua](https://avatars.discourse-cdn.com/v4/letter/w/7c8e57/32.png) [@wagqighua](https://discuss.elastic.co/u/wagqighua)\
**Post date:** [May 31, 2016, 3:50pm UTC](https://discuss.elastic.co/t/unbalanced-cluster-with-nearly-half-of-the-shards-allocated-to-a-single-node/51448/1 "2016-05-31T15:50:14Z")

</div>

There are 5 nodes in my cluster including 1 master node and 4 data nodes. 1 replica shard.  
Recently, the cluster often goes yellow because one of my data node spend too much time gcing.  
When the node recovered, I found that nearly all of the replica shards are allocated to the single node.  
Does anyone know how to solve the problem?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 31, 2016, 4:01pm UTC](https://discuss.elastic.co/t/unbalanced-cluster-with-nearly-half-of-the-shards-allocated-to-a-single-node/51448/2 "2016-05-31T16:01:50Z")

</div>

Are all your nodes running the same version of Elasticsearch? You should be able to check this through the [\_cat/nodes API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html).

---

<div class="post-metadata">

**Author:** ![wagqighua](https://avatars.discourse-cdn.com/v4/letter/w/7c8e57/32.png) [@wagqighua](https://discuss.elastic.co/u/wagqighua)\
**Post date:** [May 31, 2016, 4:18pm UTC](https://discuss.elastic.co/t/unbalanced-cluster-with-nearly-half-of-the-shards-allocated-to-a-single-node/51448/3 "2016-05-31T16:18:42Z")

</div>

all of the nodes are of version 1.5.2

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 1, 2016, 3:01am UTC](https://discuss.elastic.co/t/unbalanced-cluster-with-nearly-half-of-the-shards-allocated-to-a-single-node/51448/4 "2016-06-01T03:01:24Z")

</div>

☹ You should really upgrade.  
However it sounds like your cluster is, in general, overloaded. Are you able to increase the node size/count?

That most of the replicas are on one node really doesn't matter, as long as the shard count per node is pretty even.

---

<div class="post-metadata">

**Author:** ![wagqighua](https://avatars.discourse-cdn.com/v4/letter/w/7c8e57/32.png) [@wagqighua](https://discuss.elastic.co/u/wagqighua)\
**Post date:** [June 1, 2016, 3:46am UTC](https://discuss.elastic.co/t/unbalanced-cluster-with-nearly-half-of-the-shards-allocated-to-a-single-node/51448/5 "2016-06-01T03:46:20Z")

</div>

Some one changed the setting cluster.routing.allocation.balance.primary to a none zero value. So when one of my node crashes, all the shards are reallocated to other nodes; when the crashed node comes back, replica shards start to move back. For the setting 'cluster.routing.allocation.balance.primary', more than average amount of replica shards moved back. Then the once crashed node crashed again and again.

It is a very nice suggestion to upgrade my elasticsearch version. The newer version really fixed some bugs and I will upgrade my elasticsearch recently

---

<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 5, 2017, 10:47pm UTC](https://discuss.elastic.co/t/unbalanced-cluster-with-nearly-half-of-the-shards-allocated-to-a-single-node/51448/6 "2017-07-05T22:47:27Z")

</div>


