Procedure to change role of a node

I have 2 master and 1 data node in my cluster. I want to make all the three nodes as master\data nodes. What is the procedure to change the role? What are all the things to keep in mind while changing the role?

You most likely need to shutdown the cluster, change the roles and restart.
Note that it will also move indices (shards) to the new node.

I expect @dadoonet to know much more about this than I do but this is what I would do :slight_smile:

This is a sample config from one of my nodes. This is for IP 10.0.0.1

---
bootstrap.memory_lock: true
cluster.name: my_cluster
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.unicast.hosts:
- 10.0.0.1:9300
- 10.0.0.2:9300
- 10.0.0.3:9300
http.port: 9200
network.host: 10.0.0.1
node.attr.gateway: true
node.data: true
node.ingest: true
node.master: true

discovery.zen.minimum_master_nodes: 2 is needed to prevent so called "split brain".

I'll call your nodes M1, M2 and D1, for master 1, master 2 and data 1.

If you would apply the above config (modify IPs as needed, and any other config you already have in place) to M1 first and restart ES there, the master role should move to M2 and still run with your old config. M1 should start as master+data.

Wait for shard allocation settles down (equal amount of shards on M1 and D1). Disable shard allocation per https://www.elastic.co/guide/en/elasticsearch/reference/7.6/restart-cluster.html#restart-cluster-rolling

Add same config to D1 and restart. D1 should come up as master+data. M2 should still be active master and runs old config, still not requiring minimum of 2 master.

Enable shard allocation. Cluster goes GREEN. Disable shard allocation.

Apply new config to M2 and restart. M2 starts as master+data.

Enable shard allocation. Cluster goes GREEN.

You should have three nodes that are all master+data :slight_smile:

1 Like

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