elasticsearch-curatorインデックス削除、インデックスバックアップsnapshot、snapshot削除を実現
2537 ワード
公式住所:https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.htmlプロパティの説明:https://www.elastic.co/guide/en/elasticsearch/client/curator/current/about-features.html
次の例:インデックス削除、インデックスバックアップsnapshot、snapshotの削除
1.ダウンロードインストール
wget https://packages.elastic.co/curator/5/centos/7/Packages/elasticsearch-curator-5.6.0-1.x86_64.rpm
yum install elasticsearch-curator-5.6.0-1.x86_64.rpm
# elasticsearch-curator,curator config.yml( ES )、action.yml( ),
touch action.yml
touch config.yml
2.アクションの設定yml & config.yml
次の例:インデックス削除、インデックスバックアップsnapshot、snapshotの削除
actions:
1:
action: delete_indices
description: >-
Delete indices older than 7 days (based on index name), for testjiwei-
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: False
timeout_override: 300
continue_if_exception: False
filters:
- filtertype: pattern
kind: prefix
value: testjiwei-
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 7
2:
action: snapshot
description: >-
Snapshot selected indices to 'repository' with the snapshot name or name
options:
repository: dev_data
name:
#name: '' # snapshot ,name curator_
wait_for_completion: True
max_wait: 3600
wait_interval: 10
# true
disable_action: False
filters:
- filtertype: pattern
kind: regex
value: '^(ua_paper|course_exercise_extra|playback_info)'
3:
action: delete_snapshots
description: >-
Delete selected snapshots from 'repository'
options:
repository: dev_data
ignore_empty_list: True
disable_action: False
timeout_override: 3000
continue_if_exception: False
filters:
- filtertype: pattern
kind: prefix
value: curator-
- filtertype: age
source: creation_date
direction: older
unit: days
unit_count: 2 # 2 ,0
3.運転
# --dry-run , ,
curator --config /opt/elasticsearch-curator/config.yml --dry-run /opt/elasticsearch-curator/action.yml
#
curator --config /opt/elasticsearch-curator/config.yml /opt/elasticsearch-curator/action.yml