elasticsearchdata-migration

How to check that all shards are moved from a specific elasticsearch node?


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?

Solution

    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.