Elasticsearch集群管理工具curator详解-curator_cli
发表于:2025-02-09 作者:千家信息网编辑
千家信息网最后更新 2025年02月09日,介绍Curator 是一个elasticsearch集群管理工具,在日常集群管理方面的一个利器,掌握此神器,es集群日常管理将轻松+愉快。功能介绍如下:创建索引删除索引关闭索引删除快照从快照还原添加或
千家信息网最后更新 2025年02月09日Elasticsearch集群管理工具curator详解-curator_cli
介绍
Curator 是一个elasticsearch集群管理工具,在日常集群管理方面的一个利器,掌握此神器,es集群日常管理将轻松+愉快。
功能介绍
如下:
创建索引删除索引关闭索引删除快照从快照还原添加或移除索引打开已经关闭的索引更改分片路由配置强制合并索引更改索引每个分片的副本数量为索引创建快照reindices 、remote reindicesrollover indices(当某个别名指向的实际索引过大的时候,自动将别名指向下一个实际索引)等等。。。。。
安装配置(centos7)
install the public signing key:
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
添加repo 文件
RHEL/CentOS 7:
cat >/etc/yum.repos.d/es-curator.repo <<-EOF[curator-5]name=CentOS/RHEL 7 repository for Elasticsearch Curator 5.x packagesbaseurl=https://packages.elastic.co/curator/5/centos/7gpgcheck=1gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearchenabled=1EOF
安装
yum install elasticsearch-curator -y
curator的接口 介绍
curator提供了两种接口。一个是curator_cli 命令行模式 ,一个是curator API 模式。
curator_cli 命令行模式介绍
查看帮助
curator_cli --helpUsage: curator_cli [OPTIONS] COMMAND [ARGS]...
常用命令
Commands: allocation Shard Routing Allocation close Close indices delete_indices Delete indices delete_snapshots Delete snapshots forcemerge forceMerge index/shard segments open Open indices replicas Change replica count show_indices Show indices show_snapshots Show snapshots snapshot Snapshot indices
实例
查看 index
curator_cli --host 10.33.4.160 --port 9200 show_indices --verbos
ptlog-prod-userservice-2018.11.20 open 58.4MB 185964 5 1 2018-11-20T00:00:09Zptlog-prod-userservice-2018.11.21 open 58.3MB 185658 5 1 2018-11-21T00:00:12Zptlog-prod-userservice-2018.11.22 open 57.5MB 182808 5 1 2018-11-22T00:00:18Zptlog-prod-userservice-2018.11.23 open 56.7MB 180296 5 1 2018-11-23T00:00:18Z
查看 snapshots
curator_cli --host 10.33.4.160 --port 9200 show_snapshots --verbose
过滤特性 (filter)
可以根据指定条件匹配,然后指定相应的动作。
实例演示
将30天以前创建的以ptlog开头的index状态为 close
curator_cli --host 172.20.11.32 --port 9200 close --filter_list '[{"filtertype":"age","source":"creation_date","direction":"older","unit":"days","unit_count":30},{"filtertype":"pattern","kind":"prefix","value":"ptlog-"}]'
验证结果:
查看索引信息
GET _cat/indices green open 15_hot_v1 P1FnKd6FRsG7NmnoWZ5hZA 20 1 1780400 59939 1.9gb 981.1mb close ptlog-pte-prod-userservice-2018.11.12 LaAHL-KKToqQ30f0dX6pqw green open ptlog-pte-prod-userservice-2018.11.27 bXIzgcrVR1eki8NpehUWcA 5 1 91756 0 57.6mb 28.8mb close ptlog-ddv-syslog-2018.10.26 x4lnrJbbQ_uD4UXR8iXGWw green open ptlog-ddv-trace-2018.12.03 BrGrgpsYQFOQM0TVHgR-QA 5 1 110 0 896.2kb 438.6kb close ptlog-pte-prod-ptservice-2018.11.09 A4Fil2BkRUC70jjcW9iczQ close ptlog-pte-prod-userservice-2018.10.24 0eNY0RzYSNuxH5Fm5bpM9A
发现符合条件的索引状态都调整为 close !
将30天以前创建的以ptlog开头的index状态为删除
curator_cli --host 172.20.11.32 --port 9200 delete_indices --filter_list '[{"filtertype":"age","source":"creation_date","direction":"older","unit":"days","unit_count":30},{"filtertype":"pattern","kind":"prefix","value":"ptlog-"}]'
输入结果如下:
2018-12-12 14:33:57,064 INFO ---deleting index ptlog-ddv-syslog-2018.10.23...........2018-12-12 14:33:57,066 INFO ---deleting index ptlog-ddv-syslog-2018.11.022018-12-12 14:33:57,066 INFO ---deleting index ptlog-ddv-syslog-2018.10.312018-12-12 14:33:57,066 INFO ---deleting index ptlog-pte-prod-userservice-2018.10.25
再次查看索引信息
发现所有 close 状态的索引都被删除了,生产环境推荐这样操作,先关闭一段时间观察,然后再删除数据,毕竟恢复数据比较麻烦。
GET _cat/indicesgreen open 15_hot_v1 P1FnKd6FRsG7NmnoWZ5hZA 20 1 1780726 59943 1.9gb 987.4mbgreen open 6c_hot_v1 TIiPrWmaTRCPUShBfVdVIw 20 1 34826911 369431 37gb 18.4gbgreen open ptlog-event-pte-prod-ecology-2018.12.10 FSgH1MFkRbKkR7Y27ugNXA 2 1 0 0 1kb 522b
elasticsearch 集群管理工具curator 接口模式使用介绍
https://blog.51cto.com/michaelkang/2333607
索引
集群
管理
模式
状态
命令
快照
接口
工具
管理工具
信息
别名
实例
实际
开头
指向
数据
条件
结果
配置
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络安全中的访问控制
数据库10g安装黑框没了
软件开发效率书籍推荐
网络安全意识主题班会总结
网络安全你知道吗教案
网宿科技在网络安全中的作用
录象软件开发
数据库六大容器
soul服务器多少钱一个月
荔湾物联网软件开发排名
部队医院手机网络安全教育
虹口区专业软件开发市场价格
软件开发靠谱公司
怎么进服务器我的世界网易
数据安全和网络安全
软件开发需求文档范文
天津 软件开发 项目经理
湖北宏威网络技术有限公司
特别讨厌游戏软件开发者
千方科技互联网
网易明日之后服务器装备
网络安全防护小知识小口诀
湖南碰胡软件开发公司
重庆实景语乐软件开发有限公司
数据库如何向表中添加列值为空
msql数据库密码策略
用什么数据库连接池
网络安全白国强
网络安全大赛知识点
数据库程序员考试时间