美文网首页
elasticsearch索引自动清理

elasticsearch索引自动清理

作者: Jackware | 来源:发表于2017-10-13 10:34 被阅读0次

查看所有的索引文件:

curl -XGET http://localhost:9200/_cat/indices?v

删除索引文件以释放空间:

curl -XDELETE http://localhost:9200/filebeat-2016.12.28

单节点的elk可在索引目录删除索引文件:集群环境删除某节点的索引文件,会导致集群服务不可用.集群环境需要使用API的方式进行删除.

索引文件保留在服务器中,大大减小服务器的性能,占用硬盘空间,

因此使用脚本自动删除elk中两个月以前的索引以释放空间:

--#!/bin/bash

find '/data/elasticsearch/data/elks/nodes/0/indices/' -name 'filebeat-*' -ctime +60 > index.txt

cd ~

cat index.txt | while read line

do

curl -XDELETE "http://localhost:9200/"$(basename $line)""

done

添加计划任务:

$crontab -e

0 0 * * * cd /root && ./elk_index_remove.sh >>/dev/null

相关文章

  • es索引清理

    elasticsearch索引清理脚本

  • elasticsearch索引自动清理

    查看所有的索引文件: curl -XGET http://localhost:9200/_cat/indices?...

  • elasticsearch 索引管理

    1、创建索引:待定! 在 config/elasticsearch.yml 禁止自动创建索引: 2、删除索引: 3...

  • elasticsearch 自动清理

    cat /opt/scripts/esindexclear.sh编辑以下脚本

  • ELK

    架构 Elasticsearch 是个开源分布式搜索引擎,它的特点有:分布式,零配置,自动发现,索引自动分片,索引...

  • 初识ElasticSearch

    ElasticSearch是一个分布式搜索引擎。支持索引自动分片,索引副本机制,restful接口,多数据源,自动...

  • Elastic Stack

    概述 Elasticsearch是个开源分布式搜索引擎,它的特点有:分布式,零配置,自动发现,索引自动分片,索引副...

  • 使用Fluentd、Elasticsearch、Kibana共同

    Elasticsearch是个开源分布式搜索引擎,它的特点有:分布式,零配置,自动发现,索引自动分片,索引副本机制...

  • Index Mgmt(management)

    创建一个索引 1、创建索引 默认情况是自动创建索引,可通过更改每个节点的config/elasticsearch....

  • Elasticsearch的索引自动清理及自定义清理

    近发现elasticsearch近期索引文件大的吓人,清理了下之前的索引文件,发现服务器性能大大的减轻了一半,想一...

网友评论

      本文标题:elasticsearch索引自动清理

      本文链接:https://www.haomeiwen.com/subject/kutzyxtx.html