Paul T Davies
Paul T Davies

Reputation: 2573

Unable to move Elasticsearch shards

I have an Elasticsearch cluster with two nodes and eight shards. I am in the situation where all primaries are on one node and all replicas are on the other.

Running the command:

http://xx.xx.xx.1:9200/_cat/shards

returns this result:

myindex              2 r STARTED 16584778   1.4gb xx.xx.xx.2 node2
myindex              2 p STARTED 16584778   1.4gb xx.xx.xx.1 node1
myindex              1 r STARTED 16592755   1.4gb xx.xx.xx.2 node2
myindex              1 p STARTED 16592755   1.4gb xx.xx.xx.1 node1
myindex              3 r STARTED 16592009   1.4gb xx.xx.xx.2 node2
myindex              3 p STARTED 16592033   1.4gb xx.xx.xx.1 node1
myindex              0 r STARTED 16610776   1.3gb xx.xx.xx.2 node2
myindex              0 p STARTED 16610776   1.3gb xx.xx.xx.1 node1

I am trying to swap around certain shards by posting this command:

http://xx.xx.xx.1:9200/_cluster/reroute?explain

with this body:

{
    "commands" : [
        {
            "move" : {
                "index" : "myindex",
                "shard" : 1,
                "from_node" : "node1",
                "to_node" : "node2"
            }
        },
        {
            "allocate_replica" : {
                "index" : "myindex",
                "shard" : 1,
                "node" : "node1"
            }
        }
    ]
}

It doesn't work, and the only "NO" I get in the list of decisions in the explainitions is:

{
    "decider": "same_shard",
    "decision": "NO",
    "explanation": "the shard cannot be allocated on the same node id [xxxxxxxxxxxxxxxxxxxxxx] on which it already exists"
},

It's not fully clear to me if this is the actual error, but there is no other negative feedback. How can I resolve this and move my shard?

Upvotes: 0

Views: 416

Answers (1)

dadoonet
dadoonet

Reputation: 14512

This is expected. Why would you do that? Primaries and replicas are doing the same job.

What problems do you think this would solve?

Upvotes: 1

Related Questions