Influence master selection in elasticsearch

How can I influence the master selection, or how does Elasticsearch select the next master node?

As far as I have discovered, it is not possible to influence this, but:
Currently, it is always data node 01 for me, but I would like to create a dedicated master. This master should then naturally be selected preferentially, as this is its only job. The other nodes have additional roles such as data, transform, etc.

So far, when performing a rolling upgrade, I always start data nodes 1 to 6 one after the other. But Node 1 is always the master. If there is no fixed priority, why is 1 always the master?
Is the master role influenced by internal ID (order of the nodes created), longest uptime, or something similar?

You can influence the master selection with the master and voting_only roles.

I know my question was whether anything else plays a role in selecting the master.
Otherwise, in my cluster, one system would not always become the master, even though three (identical) servers have the master role, which means they can also become the master.

Therefore, it does not appear to be a random assignment to me.

It's almost always a simple race: the first node to start an election will typically win it and become the master.

There may be some situations where the order of iteration in a Java Map matters but you can't control this yourself.

Why does it matter?

1 Like

It matters if you create extra dedicated master server but still want to keep the master role on other servers as a backup.
Since it always selects the same server as the master for me, I thought there might be another factor involved. The update/reboot sequence is always the same, which is why I suspect it has something to do with that.