Reputation: 25
I have a cluster with several nodes. I want to change the data nodes to master-data nodes dynamically so there is no downtime. What's the best way to go about doing this?
Upvotes: 0
Views: 6169
Reputation: 134
You could also look at excluding the current data node from hosting shards per https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-filtering.html This will move the shards to other data nodes.
Then once the node has no shard (GET _cat/shards?v), you can then restart it after setting node.data: false in elasticsearch.yml
Don't forget to set discovery.zen.minimum_master_nodes correctly per https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html#split-brain
Upvotes: 3
Reputation: 26
You cant change the role of a node dynamically, you will have to restart it after you have edited the elasticsearch.yml configuration to specify which roles you do or do not want the node to perform.
To avoid outages ensure you have at least one replica set for the affected indices and another available node(recommended) to take on the responsibility you are removing from your to-be dedicated master nodes. The cluster should recover appropriately and with replicas should appear seamlessly.
Once you have your dedicated master nodes you will also want to remove the role from the rest of your cluster nodes, which will also require a restart. Do a rolling restart (ie. one at a time, or equal to the number allotted for failure) but before doing so disable shard allocation. once the cluster is back online re-enable shard allocation. This will prevent unsolicited recoveries from happening.
~Regards
Upvotes: 0