Set number of replicas to 0 for all indices and index templates

We're running an Elastic Cloud APM setup for a small application. As this is not critical data we're deliberately using only a single zone across all tier. We are aware of the potential consequences of downtime or data loss.

However, all index templates, and thus all indices, have settings.index.number_of_replicas = 1 by default so the health status has lots of This cluster has X unavailable replica shards. warnings. I understand where the warning is coming from (we have only one zone so Elastic can't distribute the replicas) but we deliberately only want one zone so I want to get rid of this warning.

I'm now going through all indices and index templates to manually configure settings.index.number_of_replicas = 0. However, when we set up a new APM integration this might create a new index template with number_of_replicas = 1 and then I'm starting all over again.

I'm not sure anymore but we might have started out the deployment with two zones and then scaled down to one zone so this might be an artifact of that situation.

How can I configure the APM instance so that all new index templates by default have number_of_replicas = 0?

Related: How can I suppress the Your deployment and data could become unavailable health warning?

Again, we are aware of the consequences but acknowledging that, I want my health to be green.

Hi,

You can set the number of replicas in the APM Server configuration file (apm-server.yml) using the setup.template.settings.index.number_of_replicas setting

Regards

Thanks @yago82! Is this applicable for Elastic Cloud as well, or just when self-hosting? Where would I edit the apm-server.yml in Elastic Cloud?

1 Like