curator工具
Elasticsearch集群如果经过一系列优化之后,数据确实超过了集群能承载的能力,除了拆分集群以外,最后就只剩下一个办法了:清除废旧索引!为了更加方便的做清除数据,合并segment、备份恢复等管理任务,Elasticsearch在提供相关API的同事,另外准备了一个命令行工具,叫curator。curator是Python程序,可以直接通过Pypi库安装:
pip install elasticsearch-curator
安装安装完成之后会有两个命令可用
读取配置文件的curator
读取命令行参数的curator_cli
配置文件可以灵活的filter和action做到复杂逻辑处理,不过一般来说使用curator_cli做够了。
curator_cli可用参数如下:
# curator_cli
Usage: curator_cli COMMAND ...
Options:
--config PATH Path to configuration file. Default:
~/.curator/curator.yml
--host TEXT Elasticsearch host.
--url_prefix TEXT Elasticsearch http url prefix.
--port TEXT Elasticsearch port.
--use_ssl Connect to Elasticsearch through SSL.
--certificate TEXTPath to certificate to use for SSL validation.
--client-cert TEXTPath to file containing SSL certificate for client auth.
--client-key TEXT Path to file containing SSL key for client auth.
--ssl-no-validate Do not validate SSL certificate
--http_auth TEXT Use Basic Authentication ex: user:pass
--timeout INTEGER Connection timeout in seconds.
--master-only Only operate on elected master node.
--dry-run Do not perform any changes.
--loglevel TEXT Log level
--logfile TEXT log file
--logformat TEXT Log output format .
--version Show the version and exit.
--help Show this message and exit.
Commands:
allocation Shard Routing Allocation
close Close indices
delete_indices Delete indices
delete_snapshotsDelete snapshots
forcemerge forceMerge index/shard segments
open Open indices
replicas Change replica count
show_indices Show indices
show_snapshots Show snapshots
snapshot Snapshot indices
# 针对具体的command,还可以继续使用--help查看该子命令的帮助,比如查看close子命令的帮助。
# curator_cliclose --help
Usage: curator_cli close
Close indices
Options:
--delete_aliases Delete all aliases from indices to be closed
--ignore_empty_listDo not raise exception if there are no actionable
indices
--filter_list TEXT JSON string representing an array of filters.
--help Show this message and exit.
页:
[1]