Elasticsearch 集群管理工具curator 接口模式使用介绍
2018-12-20 21:50
405 查看
安装配置参考文档:
http://blog.51cto.com/michaelkang/2333586
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 http_auth: timeout: 30 master_only: False logging: 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
支持的动作如下:
Alias Allocation Close Cluster Routing Create Index Delete Indices Delete Snapshots forceMerge Index Settings Open Reindex Replicas Restore Rollover Shrink Snapshot
option: 选项 ,filter:过滤条件,哪些index需要执行action,详细参考官网;
https://www.elastic.co/guide/en/elasticsearch/client/curator/current/actions.html
实例
实例1 :定期删除旧index
more delete_indices-eslog-ptlog.yml actions: 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.阅读更多
相关文章推荐
- Elasticsearch集群管理工具head插件 使用指南
- 前端接口自动化测试工具-DOClever(免费开源的接口管理平台)使用介绍
- elasticsearch集群管理工具head
- 分布式搜索elasticsearch集群管理工具head
- 分布式搜索elasticsearch 集群管理工具head,bigdesk
- elasticsearch集群管理工具head插件
- Tokyo Tyrant管理工具tcrmgr使用介绍
- 使用Chef管理windows集群 | 运维自动化工具
- 分布式搜索elasticsearch集群管理工具head
- ELK研究(一):elasticsearch java api接口操作ES集群 ---TransportClient的使用介绍 bulk批量提交数据
- Kafka集群管理工具kafka-manager的安装使用
- 使用Micrisoft.net设计方案 第三章Web表示模式 Web模式集群详细介绍 Intercepting Filter(截取筛选器)
- 使用Micrisoft.net设计方案 第三章Web表示模式 Web模式集群详细介绍 Observer(观察器)
- 源代码管理工具SVN的使用(一)(大体介绍)
- 使用概要管理工具创建定制概要文件,并在此节点上 创建集群以及在集群服务器中部署应用
- elasticsearch安装与使用(2)-- centos7 安装测试的集群工具elasticsearch head
- 接口测试工具-Jmeter使用笔记(三:管理请求服务器信息和Headers参数)
- elasticsearch权限管理 x-pack 6.0 的安装及Security模块使用 内置角色介绍
- 文件系统管理 之 Linux 查看磁盘分区、文件系统、使用情况的命令和相关工具介绍
- MagicMongoDBTool数据管理工具使用介绍