Bret
Bret

Reputation: 1475

Can I Convert ElasticSearch data node to non-data node without data loss?

I've got a cluster of 4 elasticsearch nodes and they all have node.data=true. I'd like to convert one of them to being a non-data node; is that as simple as just changing the yaml file and restarting, or will I risk data loss if I do that?

Or am I better off just standing up another VM and adding it to the cluster as a non-data node?

Upvotes: 1

Views: 297

Answers (1)

avr
avr

Reputation: 4883

There are couple ways you can achieve this with out any data loss!

Approach-1:

Move all shards from data node X to other data nodes using Shard Allocation Filtering settings then stop node X then start it as non-data node.

You can either whitelist(index.routing.allocation.include.{attribute}) or blacklist(index.routing.allocation.exclude.{attribute}) data nodes from storing shards by using Shard Allocation Filtering settings. You can read more about it here.

Warning: If you have very large indices spread across the cluster then this approach may take long time to move shards and it depends on your bandwidth.

Approach-2:

Making sure all indices having replica shards of at least 1 and stop data node X then start it as non-data node

This may look simple but little risky. Your cluster state may go from red to yellow and green. You can read more about this case here.

Its always recommended taking backup of whole data before doing these kind of changes to cluster

Here X is the data node which you want to convert to non-data node.

Upvotes: 2

Related Questions