【cluster_block_exception】写操作elasticsearch索引报错

【cluster_block_exception】操作elasticsearch索引b报错

背景

今天线上elk的数据太多,服务器的空间不足了。所以打算删除一些没用用的数据。我是用下面的request:

复制代码
POST /{index_name}/_delete_by_query?wait_for_completion=false
{
  "query": {
    "bool": {
      "must": {
        "match": {
          "loglevel": "DEBUG"
        }
      }
    }
  }
}

但是出错了。

{ _index: '',

_type: 'type',

_id: 'record id',

status: 403,

error:

{ type: 'cluster_block_exception',

reason: 'blocked by: [FORBIDDEN/8/index write (api)];' } }

导致原因:

(都是比较简单的英文,我就直接粘贴过来了):
相关帖子

from reaching red or yellow status. It does this using index.blocks.write.

The two reasons being:

Low Memory

When the JVMMemoryPressure metric exceeds 92% for 30 minutes, Amazon ES triggers a protection mechanism and blocks all write operations to prevent the cluster from reaching red status. When the protection is on, write operations fail with a ClusterBlockException error, new indexes can't be created, and the IndexCreateBlockException error is thrown.

When the JVMMemoryPressure metric returns to 88% or lower for five minutes, the protection is disabled, and write operations to the cluster are unblocked.

Low Disk Space

Elasticsearch has a default "low watermark" of 85%, meaning that once disk usage exceeds 85%, Elasticsearch no longer allocates shards to that node. Elasticsearch also has a default "high watermark" of 90%, at which point it attempts to relocate shards to other nodes.

官网对index.blocks.write参数的描述:

https://www.elastic.co/guide/en/elasticsearch/reference/6.0/index-modules.html#dynamic-index-settings

解决方法:

https://sease.io/2022/06/elasticsearch-disk-space-issue-and-rollover-solution.html

disale index.blocks.write.

复制代码
PUT /[_all|<your_index_name>]/_settings
{
  "index.blocks.write": null
}

然后再重试之前的删除请求。

相关推荐
爱思德学术9 分钟前
中国计算机学会(CCF)推荐学术会议-C(数据库/数据挖掘/内容检索):PAKDD 2026
大数据·机器学习·数据挖掘·知识发现
云淡风轻~~2 小时前
构建和部署Spark、Hadoop与Zeppelin集成环境
大数据·hadoop·spark
IT研究室2 小时前
大数据毕业设计选题推荐-基于大数据的人体体能活动能量消耗数据分析与可视化系统-大数据-Spark-Hadoop-Bigdata
大数据·hadoop·数据分析·spark·毕业设计·源码·bigdata
元基时代2 小时前
视频图文矩阵发布系统企业
大数据·人工智能·矩阵
IT研究室3 小时前
大数据毕业设计选题推荐-基于大数据的人类健康生活方式数据分析与可视化系统-大数据-Spark-Hadoop-Bigdata
大数据·生活·课程设计
武子康4 小时前
大数据-122 - Flink Watermark 全面解析:事件时间窗口、乱序处理与迟到数据完整指南
大数据·后端·flink
九河云5 小时前
在云计算环境中实施有效的数据安全策略
大数据·网络·数据库·云计算
故事很腻i6 小时前
安装elk
运维·elk·jenkins
Brianna Home6 小时前
从“码农”到“导演”:AI结对编程如何重塑软件工程范式
大数据·人工智能·深度学习·自然语言处理·chatgpt
云飞云共享云桌面6 小时前
SolidWorks服务器多人使用方案
大数据·运维·服务器·前端·网络·电脑·制造