安装curator:
官方文档地址:https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html
学习内容:
action.yaml
actions:
1:
action: ACTION1
description: OPTIONAL DESCRIPTION
options:
option1: value1
...
optionN: valueN
continue_if_exception: False
disable_action: True
filters:
- filtertype: *first*
filter_element1: value1
...
filter_elementN: valueN
- filtertype: *second*
filter_element1: value1
...
filter_elementN: valueN
2:
action: ACTION2
description: OPTIONAL DESCRIPTION
options:
option1: value1
...
optionN: valueN
continue_if_exception: False
disable_action: True
filters:
- filtertype: *first*
filter_element1: value1
...
filter_elementN: valueN
- filtertype: *second*
filter_element1: value1
...
filter_elementN: valueN
config.yaml
---
# Remember, leave a key empty if there is no value. None will be a string,
# not a Python "NoneType"
client:
hosts:
- 127.0.0.1
port: 9200
url_prefix:
use_ssl: False
certificate:
client_cert:
client_key:
ssl_no_validate: False
username:
password:
timeout: 30
master_only: False
logging:
loglevel: INFO
logfile:
logformat: default
blacklist: ['elasticsearch', 'urllib3']
action的值:curator [–config CONFIG.YML] [–dry-run] action.yml
example:
::::::::::::::
action.yaml
::::::::::::::
---
actions:
1:
action: delete_indices
description: >-
Delete the indix pro-sec-* which is sava more than one year
options:
ignore_empty_list: True
disable_action: False
filters:
- filtertype: pattern
kind: timestring
value: 'pro-sec-%Y.%m'
- filtertype: age
source: name
direction: older
timestring: '%Y.%m'
unit: months
unit_count: 11
2:
action: delete_indices
description: >-
Delete the indix elasticsearch_metrics-* which is sava more than one year
options:
ignore_empty_list: True
disable_action: False
filters:
- filtertype: pattern
kind: timestring
value: 'elasticsearch_metrics-%Y.%m.%d'
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 5
3:
action: delete_indices
description: >-
Delete the indix k8s-* which is sava more than six months
options:
ignore_empty_list: True
disable_action: False
filters:
- filtertype: pattern
kind: timestring
value: '%Y.%m.%d'
- filtertype: pattern
kind: regex
value: '^k8s-*'
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: months
unit_count: 6
::::::::::::::
config.yaml
::::::::::::::
client:
hosts:
- 10.82.88.117
port: 9200
url_prefix:
use_ssl: False
certificate:
client_cert:
client_key:
ssl_no_validate: False
username:
password:
timeout: 30
master_only: False
logging:
loglevel: INFO
logfile:
logformat: default
blacklist: ['elasticsearch', 'urllib3']