DBAtlas · Database operations atlas

Enable or disable shard allocation

ElasticsearchCluster/Node

Command

PUT /_cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.enable": "primaries"
  }
}

What it does

Restricts shard allocation cluster-wide (primaries: only primaries are allocated, none: nothing) or returns it to the default (all / null).

When to use it

Before a rolling restart, to prevent unnecessary replica relocations (the officially recommended value is "primaries").

Caution

Remember to revert the setting with null (or "all") afterwards; if it stays restricted, replicas remain unassigned. transient settings are deprecated; use persistent.

Open in DBAtlas →

Related