无法分配未分配的分片

时间:2017-01-12 10:35:41

标签: elasticsearch

我有一个2节点集群和一个包含5个分片和0个副本的索引。

ES version:1.7.3

_cat/nodes

输出:

ixca-cm-vmops15 10.200.144.76 35 13  d m node.ixca_cm_vmops15 
ixca-cm-vmops16 10.200.144.78 14 22  d * node.ixca_cm_vmops16

_cat/shards

输出

.kibana   0 p STARTED          2   7.2kb 10.200.144.78 node.ixca_cm_vmops16 
p4_search 4 p UNASSIGNED                                                    
p4_search 0 p STARTED    7375235 155.8gb 10.200.144.76 node.ixca_cm_vmops15 
p4_search 3 p UNASSIGNED                                                    
p4_search 1 p STARTED          0    144b 10.200.144.78 node.ixca_cm_vmops16 
p4_search 2 p STARTED    8145526 165.4gb 10.200.144.76 node.ixca_cm_vmops15 

由于某种原因,其中2个分片处于未分配状态。我正在尝试将分片分配给_cluster/reroute的节点,但它会引发trying to allocate a primary shard, which is disabled异常。

_cluster/reroute -d

{
  "commands": [
    {
      "allocate": {
        "index": "p4_search",
        "shard": 4,
        "node": "node.ixca_cm_vmops16"
      }
    }
  ]
}

输出

{
"error": "RemoteTransportException[[node.ixca_cm_vmops16][inet[/10.200.144.78:9300]][cluster:admin/reroute]]; nested: ElasticsearchIllegalArgumentException[[allocate] trying to allocate a primary shard [p4_search][4], which is disabled]; ",
"status": 400
}

但是,上述错误的原因是"allow_primary"未设置为true。但是,我不愿意将其设置为false,因为这会导致该分片的数据丢失,如elastic documentation中所述 -

It also accepts allow_primary flag to explicitly specify that it is allowed to explicitly allocate a primary shard (might result in data loss).

我不能丢失存储在未分配的分片中的数据(Shard 3& 4)。

我现在该怎么办?过去,我曾经成功地将未分配的分片手动分配给节点。所以为什么它现在失败了呢?

0 个答案:

没有答案