0

I'm trying to move all the shards (primary and copies) from one specific elasticsearch node to others.

While doing some studies, I came to know about Cluster-level shard allocation filtering where I can specify the node name which I want to ignore while allocating shards.

PUT _cluster/settings
{
  "transient" : {
    "cluster.routing.allocation.exclude._name" : "data-node-1"
  }
}

My questions are,

  1. If I dynamically update the setting, will the shards be moved from the nodes that I excluded to other nodes automatically?
  2. How can I check and make sure that all shards are moved from a specific node?
Kamol Hasan
  • 12,218
  • 1
  • 37
  • 46

1 Answers1

1
  1. Yes, your shards will be moved automatically, if it is possible to do so:

    Shards are only relocated if it is possible to do so without breaking another routing constraint, such as never allocating a primary and replica shard on the same node.

    More information here

  2. You can use the shards api to see the location of all shards. Alternatively, if you have access to a kibana Dashboard, you can see the shard allocation in the monitoring tab for shards or indices at the very bottom.

Stefano Branco
  • 658
  • 3
  • 14
  • 1
    Thanks. Another question, Is there a way to confirm that this move operation will not be successful because it breaks the routing constraint? – Kamol Hasan Mar 06 '20 at 03:54
  • 1
    I don't think so. But unless you have fewer new nodes than replica (which wouldn't make much sense), you probably won't have to worry about that. – Stefano Branco Mar 06 '20 at 05:32