2017-10-12 111 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

因此,將所有初選放在一個節點上,並將所有副本放在另一個節點上是完全正確的。 –