# How about Force change cluster's elected master node

**URL:** <https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648>\
**Category:** Elasticsearch\
**Created:** [September 9, 2019, 9:30am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648 "2019-09-09T09:30:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![luyuncheng](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@luyuncheng](https://discuss.elastic.co/u/luyuncheng)\
**Post date:** [September 9, 2019, 9:30am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648/1 "2019-09-09T09:30:19Z")

</div>

When i see the issues:

> <https://github.com/elastic/elasticsearch/issues/17493>

  

> <https://github.com/elastic/elasticsearch/issues/26992>

  
When talk about force change cluster's elected master node, if there is a master leave but cluster settings not changed, what if changed the cluster block level into METADATA\_WRITE? not BLOCK WRITE.  
when only BLOCK METADATA, I wonder whether a data node can continuously write (not block when new master elected) when only change the leader without metadata changed.

---

<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:** [September 9, 2019, 10:08am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648/2 "2019-09-09T10:08:50Z")

</div>

The two linked issues are about cases where a master election took much longer than expected, causing indexing requests to be rejected. Master elections should not take this long: normally it's a few seconds in 6.x and earlier, and a few hundred milliseconds in 7.x, and it's best for indexing to wait for the new master to be elected. In both cases it seems that there were infrastructural issues leading to an excessively long election, and everything worked much better once those issues were addressed. There's been another [change in Elasticsearch](https://github.com/elastic/elasticsearch/pull/39629) recently that improves the election speed under certain network partitions too.

It is true that indexing itself does not directly require the involvement of a master node and can therefore theoretically carry on if the master node fails. However, lots of other things stop working with no master, so it's simpler to block indexing until the new master is elected.

---

<div class="post-metadata">

**Author:** ![luyuncheng](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@luyuncheng](https://discuss.elastic.co/u/luyuncheng)\
**Post date:** [September 11, 2019, 5:35am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648/3 "2019-09-11T05:35:08Z")

</div>

Thanks for replying this question. I have seen these [PR39629](https://github.com/elastic/elasticsearch/pull/39629) and [PR31547](https://github.com/elastic/elasticsearch/pull/31547), It reduce the cluster blocking time when new master publish the new cluster state under certain kinds of partition.

I wonder how do you reduce the cluster blocking time when handle a leader must step down as it need to reboot for maintenance not network partitions.  
I checked some source code, when the leader want to stop itself, it would request to the next leader candidate and then start a new master election. this is what you talk about:

> [@DavidTurner](#):
>
> normally it's a few seconds in 6.x and earlier, and a few hundred milliseconds in 7.x

These time cost in elections and publish new cluster states.

---

<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:** [September 11, 2019, 6:54am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648/4 "2019-09-11T06:54:25Z")

</div>

> [@luyuncheng](#):
>
> I wonder how do you reduce the cluster blocking time when handle a leader must step down as it need to reboot for maintenance not network partitions.

I don't understand the question. If the leader is shut down then a new leader is elected very quickly already: a few seconds in 6.x and a few hundred milliseconds in 7.x.

---

<div class="post-metadata">

**Author:** ![luyuncheng](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@luyuncheng](https://discuss.elastic.co/u/luyuncheng)\
**Post date:** [September 11, 2019, 7:19am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648/5 "2019-09-11T07:19:30Z")

</div>

When a leader shut down for maintenance, all the index requests would blocked util the new leader published a new cluster\_state. i wonder is it any solutions to handle it, like only BLOCK METADATA which make data nodes can continuously write. but as you said:

> [@DavidTurner](#):
>
> lots of other things stop working with no master, so it's simpler to block indexing until the new master is elected.

so i wonder is there any other solutions?

---

<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:** [September 11, 2019, 8:43am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648/6 "2019-09-11T08:43:16Z")

</div>

> [@luyuncheng](#):
>
> so i wonder is there any other solutions?

I'm still not understanding the problem that needs solving. When you shut down the leader in a 7.x cluster you should see a brief pause in indexing (a few hundred milliseconds at most, normally much less). Is this a problem? Why?

---

<div class="post-metadata">

**Author:** ![luyuncheng](https://avatars.discourse-cdn.com/v4/letter/l/b3f665/32.png) [@luyuncheng](https://discuss.elastic.co/u/luyuncheng)\
**Post date:** [September 11, 2019, 8:58am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648/7 "2019-09-11T08:58:55Z")

</div>

Sorry, I misunderstand the block cluster as a problem.

> [@DavidTurner](#):
>
> When you shut down the leader in a 7.x cluster you should see a brief pause in indexing (a few hundred milliseconds at most, normally much less)

It is a great promotion from seconds to milliseconds,  
Thanks for your answer!👍

---

<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:** [October 9, 2019, 8:58am UTC](https://discuss.elastic.co/t/how-about-force-change-clusters-elected-master-node/198648/8 "2019-10-09T08:58:58Z")

</div>

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