# Manually move replica shard to another node

**URL:** <https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554>\
**Category:** Elasticsearch\
**Created:** [September 22, 2020, 4:05pm UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554 "2020-09-22T16:05:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Feedy](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@Feedy](https://discuss.elastic.co/u/Feedy)\
**Post date:** [September 22, 2020, 4:05pm UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554/1 "2020-09-22T16:05:17Z")

</div>

I have an unassigned replica shard that I need to assign to a node but the only node available that has "room" already has the same primary shard assigned to it. My setup:  
4 node cluster with 1 replica. I only have an issue with one index the rest are allocated properly.

```auto
Node1 Node2 Node3 Node4 UNASSIGNED
P1 R2 R0 P2 P3 P0 R1	R3

```

I would like to move replica 1 to Node3 and then run the allocate\_replica command to resolve this issue(if that's the best approach)?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 22, 2020, 10:08pm UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554/2 "2020-09-22T22:08:42Z")

</div>

> [@Feedy](#):
>
> but the only node available that has "room" already has the same primary shard assigned to it

You want to force allocation to `Node3`? How much space does it have?

---

<div class="post-metadata">

**Author:** ![Feedy](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@Feedy](https://discuss.elastic.co/u/Feedy)\
**Post date:** [September 22, 2020, 10:21pm UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554/3 "2020-09-22T22:21:33Z")

</div>

@warkolm  
my apologies for any confusion...what I mean by "room" is, its the only node that is missing a shard. the unassigned shard will not allocate to other shards because currently there are 2 shards already assigned and I am only allowing 2 shards per node. Here is the output from allocation explained command:

```auto
{
  "index" : "sessions2-200920",
  "shard" : 3,
  "primary" : false,
  "current_state" : "unassigned",
  "unassigned_info" : {
    "reason" : "REPLICA_ADDED",
    "at" : "2020-09-21T06:11:14.548Z",
    "last_allocation_status" : "no_attempt"
  },
  "can_allocate" : "no",
  "allocate_explanation" : "cannot allocate because allocation is not permitted to any of the nodes",
  "node_allocation_decisions" : [
    {
      "node_id" : "9xxx99xxxbb8S1yDg6xxx",
      "node_name" : "node2",
      "transport_address" : "xxx.xxx.xx.xx:9300",
      "node_attributes" : {
        "ml.machine_memory" : "67190153216",
        "ml.max_open_jobs" : "20",
        "xpack.installed" : "true",
        "transform.node" : "true"
      },
      "node_decision" : "no",
      "deciders" : [
        {
          "decider" : "shards_limit",
          "decision" : "NO",
          "explanation" : "too many shards [2] allocated to this node for index [sessions2-200920], index setting [index.routing.allocation.total_shards_per_node=2]"
        }
      ]
    },
    {
      "node_id" : "BVtxxxdvSxxxqXxeFLWxxx_lA",
      "node_name" : "node1",
      "transport_address" : "xxx.xxx.xx.xx:9300",
      "node_attributes" : {
        "ml.machine_memory" : "67190153216",
        "ml.max_open_jobs" : "20",
        "xpack.installed" : "true",
        "transform.node" : "true"
      },
      "node_decision" : "no",
      "deciders" : [
        {
          "decider" : "shards_limit",
          "decision" : "NO",
          "explanation" : "too many shards [2] allocated to this node for index [sessions2-200920], index setting [index.routing.allocation.total_shards_per_node=2]"
        }
      ]
    },
    {
      "node_id" : "MxxxiYkaQMSpzgxxx_0S4xxxg",
      "node_name" : "node3",
      "transport_address" : "xxx.xxx.xx.xx:9300",
      "node_attributes" : {
        "ml.machine_memory" : "67190153216",
        "xpack.installed" : "true",
        "transform.node" : "true",
        "ml.max_open_jobs" : "20"
      },
      "node_decision" : "no",
      "store" : {
        "matching_size_in_bytes" : 64147690805
      },
      "deciders" : [
        {
          "decider" : "same_shard",
          "decision" : "NO",
          "explanation" : "a copy of this shard is already allocated to this node [[sessions2-200920][3], node[xxx3iYkaxxxpxxxLL_0Sxxx], [P], s[STARTED], a[id=xxxxTLXxxxxW2xcxjxtxHLUg]]"
        }
      ]
    },
    {
      "node_id" : "xxxGvfV3xxxmOZxxxw2bxxx",
      "node_name" : "node4",
      "transport_address" : "xxx.xxx.xx.xx:9300",
      "node_attributes" : {
        "ml.machine_memory" : "67190153216",
        "ml.max_open_jobs" : "20",
        "xpack.installed" : "true",
        "transform.node" : "true"
      },
      "node_decision" : "no",
      "deciders" : [
        {
          "decider" : "shards_limit",
          "decision" : "NO",
          "explanation" : "too many shards [2] allocated to this node for index [sessions2-200920], index setting [index.routing.allocation.total_shards_per_node=2]"
        }
      ]
    }
  ]
}

```

From the output above the only way I can think of to resolve this is by moving a replica shard from its current node to node 3 and then moving unassigned to whichever node is available, expect for node 3.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 23, 2020, 3:40am UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554/4 "2020-09-23T03:40:08Z")

</div>

Can you elaborate a little more on your allocation strategy? Why do you have a max of 2 shards per node? How many shards do you have in total?

---

<div class="post-metadata">

**Author:** ![Feedy](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@Feedy](https://discuss.elastic.co/u/Feedy)\
**Post date:** [September 23, 2020, 12:45pm UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554/5 "2020-09-23T12:45:04Z")

</div>

@warkolm  
1 primary and 1 replica per node so a total of 8 shards per index

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 23, 2020, 4:43pm UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554/6 "2020-09-23T16:43:54Z")

</div>

> [@Feedy](#):
>
> From the output above the only way I can think of to resolve this is by moving a replica shard from its current node to node 3 and then moving unassigned to whichever node is available, expect for node 3.

Yes, I think this is the way to do it. You may however want to consider increasing the limit per node to at least 3 as I suspect you may end up with unallocated shards and reduced resiliency if a node failed with the current settings.

---

<div class="post-metadata">

**Author:** ![Feedy](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@Feedy](https://discuss.elastic.co/u/Feedy)\
**Post date:** [September 23, 2020, 5:08pm UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554/7 "2020-09-23T17:08:51Z")

</div>

@Christian_Dahlqvist @warkolm I'm not sure how to exactly execute that. it appears that the reroute command would be used here but from the docs I don't see away to explicitly state that I want to move a replica and allocate\_replica command appears to be for unassigned shards but I need to move a replica shard first then address the unassigned shard.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 21, 2020, 5:08pm UTC](https://discuss.elastic.co/t/manually-move-replica-shard-to-another-node/249554/8 "2020-10-21T17:08:59Z")

</div>

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