【问题标题】:deleting old indexes in amazon elasticsearch删除亚马逊弹性搜索中的旧索引
【发布时间】:2018-10-04 15:35:15
【问题描述】:
【问题讨论】:
标签:
amazon-web-services
elasticsearch
【解决方案1】:
Elasticsearch 6.6 带来了一项名为 Index Lifecycle Manager See here 的新技术。每个索引都分配有一个生命周期策略,该策略控制索引如何通过特定阶段转换,直到它们被删除。
例如,如果您要将 ATM 机群中的指标数据索引到 Elasticsearch 中,您可能会定义一个策略:
- 当索引达到 50GB 时,滚动到新索引。
- 将旧索引移至暖阶段,将其标记为只读,然后将其缩小为单个分片。
- 7 天后,将索引移至冷阶段并将其移至较便宜的硬件。
- 达到要求的 30 天保留期后删除索引。
该技术还处于测试阶段,但可能是从现在开始的方式。
【解决方案2】:
运行策展人非常轻松。
在这里您可以找到 Dockerfile、配置和操作文件。
https://github.com/zakkg3/curator
此外,如果您需要(除其他外),Curator 可以为您提供帮助:
- 从别名中添加或删除索引(或两者!)
- 更改分片路由分配
- 删除快照
- 打开封闭索引
- forceMerge 索引
- 重新索引索引,包括来自远程集群的索引
- 更改索引的每个分片的副本数
- 翻转指数
- 对索引进行快照(备份)
- 恢复快照
https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html
以下是删除超过 15 天的索引的典型操作文件:
actions:
1:
action: delete_indices
description: >-
Delete indices older than 15 days (based on index name), for logstash-
prefixed indices. Ignore the error if the filter does not result in an
actionable list of indices (ignore_empty_list) and exit cleanly.
options:
ignore_empty_list: True
disable_action: True
filters:
- filtertype: pattern
kind: prefix
value: logstash-
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 15