栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

ELK之Curator

ELK之Curator

环境:

window10

elasticsearch 7.16.3

jdk 11

curator-5.8.4

目录

一、介绍

二、配置

 1、创建 curator.yml 

 2、创建 delete_indices.yml

三、运行


需求:想要定时删除几天前es的索引数据

一、介绍

Curator是elasticsearch 官方的一个索引管理工具,可以通过配置文件的方式帮助我们对指定的一批索引进行创建/删除、打开/关闭、快照/恢复等管理操作

二、elasticsearch、curator兼容关系https://www.elastic.co/guide/en/elasticsearch/client/curator/current/version-compatibility.html

二、配置

官方配置示例:https://github.com/elastic/curator/tree/master/examples

 1、创建 curator.yml 

注意:文件中出现中文

修改hosts节点,为自己的es地址

client:
  hosts:
    - localhost
  port: 9200
  url_prefix:
  use_ssl: False
  certificate:
  client_cert:
  client_key:
  ssl_no_validate: False
  http_auth:
  timeout: 30
  master_only: False
 
logging:
  loglevel: INFO
  logfile: 
  logformat: default
  blacklist: ['elasticsearch', 'urllib3']

 2、创建 delete_indices.yml

注意:文件中出现中文

unit_count这里我设置为3天, value匹配filebeat前缀的索引

# Remember, leave a key empty if there is no value.  None will be a string,
# not a Python "NoneType"
#
# Also remember that all examples have 'disable_action' set to True.  If you
# want to use this action as a template, be sure to set this to False after
# copying it.
actions:
  1:
    action: delete_indices
    description: >-
      Delete indices older than 3 days (based on index name), for test-
      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   
      timeout_override:
      continue_if_exception: True  
      disable_action: False   
    filters:
    - filtertype: kibana  
      exclude: True
    - filtertype: opened   
      exclude: False
    - filtertype: pattern
      kind: prefix
      value: filebeat-
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: '%Y.%m.%d'
      unit: days
      unit_count: 3
      exclude: false

 说明:

ignore_empty_list : 如果为True,则在filters空列表时,继续下一个action处理而不是退出程序。
disable_action :action开关,为True表示不执行这个action,默认False
continue_if_exception :发现错误后,继续执行下一个索引操作,默认False
- filtertype: kibana : 是否排除隐藏索引,如.kibana
- filtertype: opened :是否排除open状态的索引
- filtertype: pattern :前缀匹配
- filtertype: age :处理多少天前的索引

三、运行

cmd运行:

curator --config curator.yml delete_indices.yml

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/720599.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号