安装elasticsearch-curator
1 | pip install elasticsearch-curator |
配置示例:
~/.curator/curator.yml
1 | client: |
action文件配置:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22actions:
1:
action: delete_indices
description: >-
Delete indices older than 10 days (based on index name).
options:
ignore_empty_list: True
timeout_override:
continue_if_exception: False
disable_action: False
filters:
- filtertype: pattern
kind: prefix
value: '[a-z]' #匹配小写字母开头的index
exclude:
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 10
exclude:
只按时间匹配:
1 | actions: |
执行清理:
1 | # 命令用法 |
1 | [root@test-vm150 opt]# curator ac.yml |