2

我的安装工作正常,但由于其中显示了 2 个“额外”未分配的分片,一个索引显示黄色健康状况。如何删除这些额外的碎片?我当前的设置是 0 个副本和 2 个分片。

curl -XGET 'http://localhost:9200/_cluster/health/tags?level=shards&pretty=true'
{
  "cluster_name" : "elasticsearch_inspire",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 2,
  "active_shards" : 2,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 2,
  "indices" : {
    "v1_tags" : {
      "status" : "yellow",
      "number_of_shards" : 2,
      "number_of_replicas" : 1,
      "active_primary_shards" : 2,
      "active_shards" : 2,
      "relocating_shards" : 0,
      "initializing_shards" : 0,
      "unassigned_shards" : 2,
      "shards" : {
        "0" : {
          "status" : "yellow",
          "primary_active" : true,
          "active_shards" : 1,
          "relocating_shards" : 0,
          "initializing_shards" : 0,
          "unassigned_shards" : 1
        },
        "1" : {
          "status" : "yellow",
          "primary_active" : true,
          "active_shards" : 1,
          "relocating_shards" : 0,
          "initializing_shards" : 0,
          "unassigned_shards" : 1
        }
      }
    }
  }
}
4

2 回答 2

2

我最近遇到了这个问题,即在所有节点上重新启动了 ES 进程,并且我有一些未分配的分片(集群运行状况为红色)。我做了以下手动分配碎片,这对我有用(不需要重新启动)

curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
  "commands": [
    {
      "allocate": {
        "index": "INDEXNAME",
        "shard": "SHARDNUMBER",
        "node": "PICKANODE",
        "allow_primary": 1
      }
    }
  ]
}'
于 2014-01-17T18:34:50.667 回答
0

重新启动节点似乎是解决它的唯一方法。

如果有人有不那么激进的解决方案,请发布:)

于 2013-08-27T04:35:36.353 回答