elk日志某个时间节点突然搜索不到了

elk日志某个时间节点突然搜索不到了,检查filebeat正常

Kibana手动上传数据:

响应:

Error:

Validation Failed: 1: this action would add [2] total shards, but this cluster currently has [2000]/[2000] maximum shards open

原因:ElasticSearch总分片数量导致的异常,ES总分片数限制最大只有2000个,目前已经用完了,导致已经没法创建新的索引了。

解决方案:

解决方法就是提高ES的分片数量。

方法1:控制台

PUT /_cluster/settings

{

"persistent": {

"cluster": {

"max_shards_per_node":10000

}

}

}

persistent:永久生效,transient:临时生效。

方法2:CURL命令

curl --location --request PUT 'http://127.0.0.1:9200/_cluster/settings' \

--header 'Content-Type: application/json' \

--data '{"persistent":{"cluster":{"max_shards_per_node":10000}}}'

persistent:永久生效,transient:临时生效。

查看是否生效

GET /_cluster/settings?pretty

结果

{

"persistent": {

"cluster": {

"max_shards_per_node": "10000"

}

},

"transient": {}

}

删除索引

查询索引

GET _cat/indices

显示索引的文档数

GET http://127.0.0.1:9200/_cat/count/index_name?v

定期清理索引

方式1:利用ES的索引生命周期
方式2:脚本实现(日期后缀索引YYYY.MM.DD)

#!/bin/bash

###################################

#删除早于十天的ES集群的索引

###################################

function delete_indices() {

comp_date=`date -d "10 day ago" +"%Y-%m-%d"`

date1="$1 00:00:00"

date2="$comp_date 00:00:00"

t1=`date -d "$date1" +%s`

t2=`date -d "$date2" +%s`

if [ t1 -le t2 ]; then

echo "1时间早于comp_date,进行索引删除"

#转换一下格式,将类似2017-10-01格式转化为2017.10.01

format_date=`echo $1| sed 's/-/\./g'`

curl -XDELETE http://es-cluster-ip:9200/\*$format_date

fi

}

curl -XGET http://es-cluster-ip:9200/_cat/indices | awk -F" " '{print 3}' \| awk -F"-" '{print NF}' | egrep "[0-9]*\.[0-9]*\.[0-9]*" | sort | uniq | sed 's/\./-/g' | while read LINE

do

#调用索引删除函数

delete_indices $LINE

done

手动删除

修改配置信息为'开启使用通配符或_all'

PUT /_cluster/settings { "transient": { "action.destructive_requires_name": true } }

DELETE /索引名字(可以使用*作为通配符)

相关推荐
m0_737539373 小时前
ELK企业日志分析系统
elk
LSL666_7 小时前
快速Spring Cloud+ELK+AOP搭建一个简单的项目
spring·elk·spring cloud
JackSparrow4142 天前
使用Elasticsearch代替数据库like以加快查询的各种技术方案+实现细节
大数据·clickhouse·elk·elasticsearch·搜索引擎·postgresql·全文检索
工作log3 天前
从零搭建 ELK + Kafka 日志收集系统(Spring Boot + Logback 直连 Kafka)
spring boot·elk·kafka
總鑽風14 天前
搭建Spring Boot + ELK日志平台,实现可视化日志监控
spring boot·elk·macos
七七powerful14 天前
运维养龙虾--使用workbuddy专家模式一句话部署ELK 日志分析平台
elk·workbuddy
人间打气筒(Ada)16 天前
「码动四季·开源同行」go语言:如何使用 ELK 进行日志采集以及统一处理?
开发语言·分布式·elk·go·日志收集·分布式日志系统
艾伦_耶格宇16 天前
【ELK】-1 ELK的简要介绍
elk
尽兴-22 天前
微服务日志采集与分析系统实战:ELK 架构全解析与落地
elk·微服务·架构·kibana·es·logstash·filebeat
泡沫·1 个月前
ELK 企业日志分析系统核心总结
elk