es索引管理工具-curator
elasticsearch-curator 是官方收购的开源社区周边产品,用来管理es的索引和快照。 在6.6以后官方推出了ILM(索引生命周期管理策略),更加易于操作和方便使用,可以在kibana界面直接操作。
官方文档:https://www.elastic.co/guide/en/elasticsearch/client/curator/current/index.html
功能包括:从别名添加、删除索引,更改分片路由分配,打开/关闭索引,创建/删除索引,快照管理、合并segment,更改索引分片副本数等。
目前使用的elasticsearch-curator版本是5.4, Python2.6安装会出现问题.建议在安装在python2.7+的环境中.
安装:
# pip install elasticsearch-curator
使用:
命令语法:
命令行参数: curator [--config CONFIG.YML] [--dry-run] ACTION_FILE.YML
$ curator --help
Usage: curator [OPTIONS] ACTION_FILE Curator for Elasticsearch indices.
See http://elastic.co/guide/en/elasticsearch/client/curator/current
Options:
--config PATH Path to configuration file. Default: ~/.curator/curator.yml
--dry-run Do not perform any changes. # --dry-run参数在调试action_file时比较重要
--version Show the version and exit.
--help Show this message and exit.
curator运行需两个配置文件:
config.yml:用于连接ES集群配置
action.yml:用于配置要执行的操作,文件名称可以随意命名
config.yml配置:
# cat curator.yml
# Remember, leave a key empty ifthere is no value. None will be a string,
# not a Python "NoneType"
client:
hosts:
- 172.16.10.23
- 172.16.10.24
- 172.16.10.25
port: 9200
url_prefix:
use_ssl: False
certificate:
client_cert:
client_key:
ssl_no_validate: False
http_auth:
timeout: 3600
master_only: False
logging:
loglevel: INFO
# logfile: /home/test/curator.log
logfile:
logformat: default
blacklist: ['elasticsearch', 'urllib3']
配置说明:
- hosts: 同一个集群内节点IP,如果端口不同,可写成ip:port形式;只能一次使用一个集群。在主机设置中包含来自多个集群的节点将导致错误。
- port: 默认值是9200。这个值只适用于没有端口的主机。
- timeout: 默认值是30S,根据实际使用情况调整.
- logfile: 默认值是空的,会将执行结果输出到STDOUT或控制台。如果指定文件,会把执行日志输出到文件中,而不是控制台.
- blacklist: 默认值为'elasticsearch', 'urllib3'。Python模块不被输出。除非需要调试某些问题, 否则请使用默认值.
ACTION_FILE配置
配置说明:关闭前缀为syslog- 并且 时间格式为 '%Y.%m.%d'的7天前的所有的文档.
# cat action_close.yml
---
# Remember, leave a key empty ifthere 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 thisaction as a template, be sure to set thisto False after
# copying it.
actions:
1:
action: close
description: >-
Close indices older than 30days (based on index name), forlogstash-
prefixed indices.
options:
delete_aliases: False
disable_action: False
filters: # filters下的配置都是隐含的逻辑“AND”操作链接.
- filtertype: pattern
kind: prefix
value: syslog-
- filtertype: age
source: name
direction: older
timestring: '%Y.%m.%d'
unit: days
unit_count: 7
curator_cli命令行命令行查看所有索引:
# curator_cli --config config.yml action_close.yml --verbose
执行命令:
# curator --config config.yml action_close.yml
es索引管理工具-curator的更多相关文章
- ElasticSearch 命令行管理工具Curator
一.背景 elastic官网现在已经大面积升级到了5.x版本,然而针对elasticsearch的命令行管理工具curator现在仍然是4.0版本. 刚开始找到此工具,深深的怕因为版本更迭无法使用,还 ...
- ElasticSearch——Curator索引管理
简介 curator 是一个官方的,可以管理elasticsearch索引的工具,可以实现创建,删除,段合并等等操作.详见官方文档 功能 curator允许对索引和快照执行许多不同的操作,包括: 从别 ...
- 这么简单的ES索引生命周期管理,不了解一下吗~
对于日志或指标(metric)类时序性强的ES索引,因为数据量大,并且写入和查询大多都是近期时间内的数据.我们可以采用hot-warm-cold架构将索引数据切分成hot/warm/cold的索引.h ...
- elk中es集群web管理工具cerebro
cerebo是kopf在es5上的替代者 安装es虽然不能再root下运行,但是cerebro 可以 run as root is ok wget https://github.com/lmeneze ...
- Luke 5—— 可视化 Lucene 索引查看工具,可以查看ES的索引
Luke 5 发布,可视化 Lucene 索引查看工具 oschina 发布于2015年08月31日 这是一个主要版本,该版本支持 Lucene 5.2.0. 它支持 elasticsearch ...
- SQL索引管理器 - 用于SQL Server和Azure上的索引维护的免费GUI工具
我作为SQL Server DBA工作了8年多,管理和优化服务器的性能.在我的空闲时间,我想为宇宙和我的同事做一些有用的事情.这就是我们最终为SQL Server和Azure 提供免费索引维护工具的方 ...
- elasticsearch集群管理工具head插件(转)
elasticsearch-head是一个elasticsearch的集群管理工具,它是完全由html5编写的独立网页程序,你可以通过插件把它集成到es 插件安装方法1: 1.elasticsearc ...
- Elasticsearch集群管理工具head插件安装
Elasticsearch-head是一个elasticsearch的集群管理工具,它是完全由html5编写的独立网页程序,你可以通过插件把它集成到es.或直接下载源码,在本地打开index.html ...
- Elasticsearch ES索引
ES是一个基于RESTful web接口并且构建在Apache Lucene之上的开源分布式搜索引擎. 同时ES还是一个分布式文档数据库,其中每个字段均可被索引,而且每个字段的数据均可被搜索,能够横向 ...
随机推荐
- Python 冒泡排序、归并排序、快速排序
冒泡排序 原理: 代码: def bubble_sort2(arr):for j in range(len(arr) - 1, 0, -1): # [n-1, n-2, ....2, 1]for i ...
- Python多维数组切片
1. array如果维度多了,就变成ndarray. 2. list切片类似C数组,多维度分别用”[]“索引,单维度切片用”:“,如: >>> a [[1, 2, 3], [4, 5 ...
- linux系统安装MongoDB
1.在官网https://www.mongodb.org/dl/linux/x86_64下载对应的安装压缩包,我用的是3.2.5,建议使用此版本,版本越高,可能会出现其它未知问题,比如需要glibc高 ...
- pandas nan值处理
创建DataFrame样例数据 >>> import pandas as pd >>> import numpy as np >>> data = ...
- oracle 两张关联表执行更新update
UPDATE T_ASN_DTL ad1 SET ad1.cf03=( SELECT ac.TH003 FROM "T_ASN_DTL_copy" ac WHERE ac.udf0 ...
- 程序员 面试题【前端,java,php】
跬步客 网址:https://www.kuibuke.com/wall/index
- Redis查漏补缺:最易错过的技术要点大扫盲
考虑到绝大部分写业务的程序员在实际开发中使用Redis时,只会Setvalue和Getvalue两个操作,对Redis整体缺乏一个认知.又恰逢笔者有同事下周要去培训Redis,所以笔者斗胆以Redis ...
- Task: Indoor Positioning with WiFi Signals
Task: Indoor Positioning with WiFi SignalsYou are hired by a company to design an indoor localizatio ...
- web性能测试
在公司Confluence上看到一篇好文,原链接已不能访问.先收藏 转帖自:http://blog.csdn.net/wxq8102/article/details/1735726 1.1基本概念并发 ...
- python爬取全名k歌
python3 爬取全名k歌 代码: import re import requests import ssl ssl._create_default_https_context=ssl._creat ...