# Encountered some problems in the horizontal expansion of Elasticsearch

**URL:** <https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562>\
**Category:** Elasticsearch\
**Created:** [November 20, 2018, 2:14pm UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562 "2018-11-20T14:14:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sevenfirezzz](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sevenfirezzz](https://discuss.elastic.co/u/sevenfirezzz)\
**Post date:** [November 20, 2018, 2:14pm UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/1 "2018-11-20T14:14:51Z")

</div>

My requirement is to do the horizontal expansion of Elasticsearch.  
Now I have two nodes and have created some indexes but the capacity is not enough.

I found that after a new node were added into cluster, the shards that originally on the old two nodes were reassigned until all three nodes were distributed with shards.  
when the amount of data is large, the time to wait for redistribution is too long.

Here is my question:  
1.Is there any way to not change the distribution location of the original old data? After the node is added, only the new index will be allocated on the existing three nodes.

Urge for help! Thanks a lot!

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [November 20, 2018, 4:55pm UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/2 "2018-11-20T16:55:33Z")

</div>

> [@sevenfirezzz](#):
>
> the time to wait for redistribution is too long.

Too long for what, may I ask? Or, put differently, why do you need to wait for rebalancing to finish? You can use the cluster normally while this process is ongoing.

Generally you don't want all the new indices on a single new node, because this can cause a load imbalance.

---

<div class="post-metadata">

**Author:** ![sevenfirezzz](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sevenfirezzz](https://discuss.elastic.co/u/sevenfirezzz)\
**Post date:** [November 21, 2018, 1:12am UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/3 "2018-11-21T01:12:19Z")

</div>

But when I adding a new node to a running cluster, the status of cluster is red. Doesn't it means the service is unvaliable?  
I mean that it's too long for the cluster's status turns to green, because the shards on the old nodes have to rebalance to all nodes including the new one. And when I searching in the same time, does elasticsearch know the right route to the document considering that the shards are moving?

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [November 21, 2018, 8:08am UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/4 "2018-11-21T08:08:31Z")

</div>

> [@sevenfirezzz](#):
>
> But when I adding a new node to a running cluster, the status of cluster is red.

This is unexpected. Adding a new node to a green cluster should leave it green. What is the value of `discovery.zen.minimum_master_nodes` in the config file of the new node?

---

<div class="post-metadata">

**Author:** ![sevenfirezzz](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sevenfirezzz](https://discuss.elastic.co/u/sevenfirezzz)\
**Post date:** [November 26, 2018, 2:58am UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/5 "2018-11-26T02:58:55Z")

</div>

I didn't configurate that param。  
At first, I just have 3 nodes and it seems that the master node is elected automatically. Then I add a node while not configurating the "discovery.zen.minimum\_master\_nodes" as before.

---

<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:** [November 26, 2018, 6:43am UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/6 "2018-11-26T06:43:11Z")

</div>

Not setting `minimum_master_nodes` correctly as you add master-eligible nodes can cause split-brain scenarios. I would recommend reading [this documentation](https://www.elastic.co/guide/en/elasticsearch/reference/6.5/modules-node.html#split-brain) on how to set it correctly. If you have 3 master-eligible nodes you need to set it to 2 as having it set to 1 can cause problems. If you add yet another master-eligible node you need to increase it to 3.

---

<div class="post-metadata">

**Author:** ![sevenfirezzz](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sevenfirezzz](https://discuss.elastic.co/u/sevenfirezzz)\
**Post date:** [November 26, 2018, 6:45am UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/7 "2018-11-26T06:45:53Z")

</div>

So If I have 3nodes now and I set minimum\_master\_nodes=2.  
Then I add a new node to this cluster, I set minimum\_master\_nodes=3 in the configuration file of node4.  
Does that be enough? Or I also have to change the configuration file of all old nodes and reload the cluster?

---

<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:** [November 26, 2018, 6:50am UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/8 "2018-11-26T06:50:13Z")

</div>

I believe you should be able to change it through the [cluster update settings API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html).

---

<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:** [December 24, 2018, 6:50am UTC](https://discuss.elastic.co/t/encountered-some-problems-in-the-horizontal-expansion-of-elasticsearch/157562/9 "2018-12-24T06:50:15Z")

</div>

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