2017-10-12 68 views
0

我有一个具有两个节点和八个碎片的Elasticsearch集群。我处于所有初选都在一个节点上而所有副本在另一个节点上的情况。无法移动Elasticsearch碎片

运行命令:

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

返回此结果:

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 

这身搭配:

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

它不工作,而只有“NO”我决定在explainitions列表中得到的是:

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

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

回答

1

这是预期的。 你为什么要那样做?初级和副本都在做同样的工作。

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

+0

我对Elasticsearch的大部分指导意见都提示,最好将可扩展主节点分布在可用节点上?我不是这种情况? –

+0

如果是这样的话,elasticsearch会在分配副本后自动执行此操作。你从哪里读到的? – dadoonet

+0

因此,将所有初选放在一个节点上,并将所有副本放在另一个节点上是完全正确的。 –