ElasticSearch6.8:未分配的碎片

z9smfwbn  于 2023-08-03  发布在  ElasticSearch
关注(0)|答案(1)|浏览(137)

我的elasticsearch有一些未分配的碎片。我使用下面的命令找到它,如下所示未分配分片的原因是副本节点的INDEX_CREATION,这是什么意思?我的elasticsearch运行在单机,单节点集群上。我可以直接删除这个未分配的碎片吗?这将是数据丢失的问题?
先谢谢你

curl -XGET localhost:9200/_cat/shards?h=index,shards,state,prirep,unassigned.reason | grep UNASSIGNED
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 31005  100 31005    0     0  1081k     filebeat-6.8.22-<MY_APP_NAME>-2023.06.28                    UNASSIGNED r INDEX_CREATED

字符串

curl -XGET localhost:9200/_cluster/allocation/explain的结果

{
  "index": "filebeat-6.8.22-xxx-2023.06.28",
  "shard": 2,
  "primary": false,
  "current_state": "unassigned",
  "unassigned_info": {
    "reason": "INDEX_CREATED",
    "at": "2023-06-27T22:30:57.674Z",
    "last_allocation_status": "no_attempt"
  },
  "can_allocate": "no",
  "allocate_explanation": "cannot allocate because allocation is not permitted to any of the nodes",
  "node_allocation_decisions": [
    {
      "node_id": "Uhqplef-S3mJRdDIonSGPw",
      "node_name": "Uhqplef",
      "transport_address": "x.x.x.x:9300",
      "node_attributes": {
        "ml.machine_memory": "37665476608",
        "xpack.installed": "true",
        "ml.max_open_jobs": "20",
        "ml.enabled": "true"
      },
      "node_decision": "no",
      "weight_ranking": 1,
      "deciders": [
        {
          "decider": "same_shard",
          "decision": "NO",
          "explanation": "the shard cannot be allocated to the same node on which a copy of the shard already exists [[filebeat-6.8.22-xxx-2023.06.28][2], node[Uhqplef-S3mJRdDIonSGPw], [P], s[STARTED], a[id=Gh6Wxo0QROC_x68MNPq1TQ]]"
        }
      ]
    }
  ]
}

wsxa1bj1

wsxa1bj11#

由于您有一个数据节点,并且您的索引有一个主分片和一个副本分片,因此副本分片不能分配给任何节点,因为主分片和副本分片不能分配给同一个节点。
您可以简单地删除复制副本,如下所示:

PUT filebeat-*/_settings
{
  "index.number_of_replicas": 0
}

字符串
如果你有filebeat索引的索引模板,你也可以在索引模板中进行修改,这样就可以在没有副本碎片的情况下创建新的索引。

相关问题