首页 > 解决方案 > 收缩后如何删除elasticsearch中的孤立数据?

问题描述

Elasticsearch 表示索引数据为 65Gb。但磁盘上的数据文件夹大小为 95 Gb。那么,如何查找和删除那些 30Gb?

在我的 Windows 服务器上,我的 elasticsearch 版本 6.1 具有近 70Gb 的数据。升级到 6.7 后,我设置了一个生命周期策略来缩小旧索引。我想缩小过程在磁盘上留下了一些数据(旧索引?)。如果它与问题有关,我的弹性健康看起来很正常:

{
  "cluster_name" : "elasticsearch",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 311,
  "active_shards" : 311,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

我可以在监控中看到状态为已删除/已关闭的旧索引。例如:

log-2018.08.01
Health: Deleted / Closed Deleted / Closed
25.2 MB

log-2018.08.02
Health: Deleted / Closed Deleted / Closed
65.2 MB

log-2018.08.03
Health: Deleted / Closed Deleted / Closed
99.9 MB

但是 elasticsearch 将它们显示为别名:

DELETE /log-2018.08.01

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "The provided expression [log-2018.08.01] matches an alias, specify the corresponding concrete indices instead."
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "The provided expression [log-2018.08.01] matches an alias, specify the corresponding concrete indices instead."
  },
  "status": 400
}

UPD 我想,有一个错误,导致孤立的文件。我运行查询:

GET /log-2018.08.01/_settings/*uuid

并得到结果:

{
  "shrink-log-2018.08.01" : {
    "settings" : {
      "index" : {
        "resize" : {
          "source" : {
            "uuid" : "CDwuD72lSs-1CMsoIFFQiw"
          }
        },
        "shrink" : {
          "source" : {
            "uuid" : "CDwuD72lSs-1CMsoIFFQiw"
          }
        },
        "uuid" : "mKZ4VWwnTVWkZGw77pMbwg"
      }
    }
  }
}

两个文件夹(源“CDwuD72lSs-1CMsoIFFQiw”和收缩“mKZ4VWwnTVWkZGw77pMbwg”)都存在于磁盘上。但是elastic说log-2018.08.01是一个别名。并且源索引看起来被破坏/切割(例如没有“状态”)

├───0
│   └───index
│           _3p.dim
│           _3p.fdt
│           _3p.nvd
│           _3p_Lucene50_0.doc
│           _3p_Lucene50_0.pos
│           _3p_Lucene50_0.tim
│           _3p_Lucene70_0.dvd

标签: elasticsearch

解决方案


推荐阅读