Add New Node

Hello! My name is Hoang. I'm a newbie. I doing a project and use ElasticSearch. In Cluster, these are three nodes. I config, each shard is (3 primary shard and 2 replica). Now, I want to add a new node to Cluster.
Question:

  • How ElasticSearch allocate will allocate shards (Primary Shards + Replica Shards)?
  • Do I need to change the number of shards? (Example: 4 nodes => (4 Primary Shards + ....))

Thank you so much!

Hi @Hoang_Ph_m,

Elasticsearch will automatically balance the existing shards over all 4 nodes if you add another node.

The number of primary shards do not have to be increased. The right number of primary shards depends on your workload and is best found through experimenting/benchmarking. It is typically a good idea to keep the number of primary shards low (but high enough to fan out the load necessary). This blog post has more info on the subject.

The number of replica shards also do not need to be increased. The primary factor here is availability (with 2 replicas, you can already lose two data nodes without losing data availability (depending on your master node setup though)).