elasticsearch历史数据清理
16lz
2021-03-27
elasticsearch历史数据清理-手动方式清理
环境
- es为docker单机启动,版本7.1.1
实施
1.查看是否支持通配符批量删除索引(false=支持,true=不支持)
curl -X GET "172.168.1.116:9200/_cluster/settings?pretty"{ "persistent" : { "action" : { "destructive_requires_name" : "false" } }, "transient" : { }}
2.如果为true执行
curl -H "Content-Type: application/json" -XPUT '172.168.1.116:9200/_cluster/settings' -d '{"persistent": {"action.destructive_requires_name": "false"}}'
3.查看所有索引
curl -X GET "172.168.1.116:9200/_cat/indices?v"
4.修改destructive_requires_name=false后执行如下命令
curl -X DELETE "172.168.1.116:9200/filebeat-7.1.1-2021.02*?pretty"
- 说明: 172.168.1.116:9200 改为实际的es地址和端口,filebeat-7.1.1-2021.02 改为实际的索引名,是通配符
检查
- 清理前es目录大小du -sh elasticsearch/data/50G elasticsearch/data/- 清理后es目录大小du -sh elasticsearch/data/4.9G elasticsearch/data/
定时处理
参考
- https://www.qikegu.com/docs/3063
- https://www.elastic.co/guide/cn/elasticsearch/guide/current/retiring-data.html
- https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html#delete-index-api-path-params
- https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html
更多相关文章
- always on 清理日志记录
- 苹果Mac重复文件清理工具:Duplicate File Finder Pro
- Mybatis 中万能 Map (代替实体类) 和 模糊查询写法
- Excel提取中文,数字和字母,一分钟搞定!
- 通配符、用户组管理与文件权限
- 【Android】一键清理后台实现【附源码】
- Android(安卓)studio rebuild之后找不到R文件
- Linux Android(安卓)下如何读取SD卡的ID--读取SD Card ID(SD CID
- 手机游戏怎样不再卡顿 猎豹清理大师5.6手机加速功能实测