Index.number_of_replicas setting is not applied during ES startup

I have a question regarding index.number_of_replicas setting in elasticsearch.yml. I'm using elastisearch 2.4. Let me explain the situation. I mirror the ES index from single (PROD) node into 3 nodes, which together form a 3 node cluster. To ensure resilience I configured each node via elasticsearch.yml to contain:

index.number_of_shards: 1
index.number_of_replicas: 2

The problem is after I start up the cluster, replicas are not being created.

index                              shard prirep state       docs   store ip           node
searchables_c-03_production_cplace 0     p      STARTED    87920   408mb 10.96.63.251 ES1
searchables_c-01_production_cplace 0     p      STARTED 12498936 293.4gb 10.96.63.148 ES2
searchables_c-02_production_cplace 0     p      STARTED   530056     4gb 10.96.63.248 ES3

How can I ensure replica creation is issued at startup?
When I use API, replicas are being created:

curl http://10.96.63.248:9200/_cat/shards?v

index                              shard prirep state            docs   store ip           node
searchables_c-03_production_cplace 0     p      STARTED         87920   408mb 10.96.63.251 ES1
searchables_c-03_production_cplace 0     r      INITIALIZING                  10.96.63.148 ES2
searchables_c-03_production_cplace 0     r      INITIALIZING                  10.96.63.248 ES3
searchables_c-01_production_cplace 0     r      INITIALIZING                  10.96.63.251 ES1
searchables_c-01_production_cplace 0     p      STARTED      12498936 293.4gb 10.96.63.148 ES2
searchables_c-01_production_cplace 0     r      INITIALIZING                  10.96.63.248 ES3
searchables_c-02_production_cplace 0     r      INITIALIZING                  10.96.63.251 ES1
searchables_c-02_production_cplace 0     r      INITIALIZING                  10.96.63.148 ES2
searchables_c-02_production_cplace 0     p      STARTED        530056     4gb 10.96.63.248 ES3

Can anyone help?

2.4 is EOL for years now.

It's super urgent that you upgrade to 7.14.1. 8.0.0-alpha1 has been released as well.

In those versions, setting the number of shards in elasticsearch.yml is not supported anymore.
Instead you should use index templates.

1 Like

Thank you for the answer. I'm forced to use 2.4 as this is the version which is supported by the application. I will use API to trigger replication for now. There will be application upgrade later on this year, and with that new ES 7 come into the game.

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