Elasticsearch 集群管理工具curator 接口模式使用介绍

网友投稿 689 2022-09-28

Elasticsearch 集群管理工具curator 接口模式使用介绍

Elasticsearch 集群管理工具curator 接口模式使用介绍

安装配置参考文档:​​​接口模式使用介绍

curator的命令行语法如下:

curator [--config CONFIG.YML] [--dry-run] ACTION_FILE.YML

--config : 之后跟上配置文件--dry-run :调试参数,测试脚本运行是否正常;ACTION_FILE.YML :action文件中可以包含一连串的action,curator接口集中式的config和action管理,可以方便我们重用变量,更利于维护和阅读。环境初始化也可以至通过 curator [--config CONFIG.YML] 直接指定#### linux 默认查找路径:

~/.curator/curator.yml

环境初始化也可以至通过 curator [--config CONFIG.YML] 直接指定

#### 初始化系统环境

配置 [--config CONFIG.YML]

mkdir -p ~/.curator/vim ~/.curator/curator.yml

---# Remember, leave a key empty if there is no value. None will be a string,# not a Python "NoneType"client: hosts: - 172.20.11.32 《== 集群节点IP地址,可以写多个 port: 9200 《== datanode 接口 url_prefix: use_ssl: False certificate: client_cert: client_key: ssl_no_validate: False timeout: 30 master_only: Falselogging: loglevel: INFO 《== 日志级别 logfile: 《== 输出日志到文件 logformat: default blacklist: ['elasticsearch', 'urllib3']

重要选项介绍

loglevel 支持 :CRITICAL will only display critical messages.ERROR will only display error and critical messages.WARNING will display error, warning, and critical messages.INFO will display informational, error, warning, and critical messages.DEBUG will display debug messages, in addition to all of the above.logfile 支持:default, json, logstash 或者留空;blacklist 支持:那些关键字开头索引日志不输出,默认即可。

ACTION_FILE.YML 介绍

action每个action由三部分组成: - action,具体执行什么操作 - option, 配置哪些可选项 - filter, 过滤条件,哪些index需要执行action

支持的动作如下:

AliasAllocationCloseCluster RoutingCreate IndexDelete IndicesDelete SnapshotsforceMergeIndex SettingsOpenReindexReplicasRestoreRolloverShrinkSnapshot

option: 选项 ,filter:过滤条件,哪些index需要执行action,详细参考官网;

​​:定期删除旧index

more delete_indices-eslog-ptlog.ymlactions: 1: action: delete_indices description: >- 删除超过20天的索引(基于索引名称),monitoring-* 前缀索引。如果过滤器没有导致错误,请忽略错误 可操作的索引列表(ignore_empty_list)并彻底退出. options: ignore_empty_list: True disable_action: False filters: - filtertype: pattern kind: regex value: '^(\.monitoring-(es|kibana|logstash)-).*$' - filtertype: age source: name direction: older timestring: '%Y.%m.%d' unit: days unit_count: 20 2: action: delete_indices description: >- 删除超过10天的索引(基于索引名称ptlog) options: ignore_empty_list: True disable_action: False filters: - filtertype: pattern kind: prefix value: ptlog - filtertype: age source: name direction: older timestring: '%Y.%m.%d' unit: days unit_count: 10

实例2:reindex每天生成的index文件到月index文件

将所有每天生成的ptlog-dd-trace-prod-app-gateway-2018.11.文件汇总到 ptlog-dd-trace-prod-app-gateway-2018.11 月日志文件,然后删除 ptlog-dd-trace-prod-app-gateway-2018.11. 的日志文件。

用于合并琐碎index文件,减少集群分片数;

awsesbak-reindex.yml ---actions: 1: description: >- Reindex 11月份每天生成的index数据到 ptlog-$name-2018.11 action: reindex options: disable_action: False wait_interval: 9 max_wait: -1 request_body: source: index: REINDEX_SELECTION dest: index: ptlog-dd-trace-prod-app-gateway-2018.11 filters: - filtertype: pattern kind: prefix value: ptlog-dd-trace-prod-app-gateway-2018.11. 2: action: delete_indices description: >- 删除已经完成合并的索引 options: ignore_empty_list: True disable_action: False filters: - filtertype: pattern kind: prefix value: ptlog-dd-trace-prod-app-gateway-2018.11.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:ceph集群报错:HEALTH_ERR 1 pgs inconsistent; 1 scrub errors
下一篇:Windows 包管理工具 Scoop 安装部署
相关文章

 发表评论

暂时没有评论,来抢沙发吧~