无法移动 Elasticsearch 分片

Unable to move Elasticsearch shards

我有一个包含两个节点和八个分片的 Elasticsearch 集群。我处于所有主节点都在一个节点上而所有副本都在另一个节点上的情况。

运行命令:

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

returns这个结果:

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

我正在尝试通过发布此命令来交换某些碎片:

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

用这个 body:

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

它不起作用,我在解释的决定列表中得到的唯一 "NO" 是:

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

我不太清楚这是否是实际错误,但没有其他负面反馈。我该如何解决这个问题并移动我的碎片?

这是意料之中的。 为什么要这么做?主节点和副本节点做同样的工作。

您认为这会解决什么问题?