【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
}

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

相关推荐
东哥说-MES|从入门到精通6 小时前
GenAI-生成式人工智能在工业制造中的应用
大数据·人工智能·智能制造·数字化·数字化转型·mes
万岳软件开发小城6 小时前
教育APP/小程序开发标准版图:课程、题库、直播、学习一站式梳理
大数据·php·uniapp·在线教育系统源码·教育app开发·教育软件开发
STLearner8 小时前
AI论文速读 | U-Cast:学习高维时间序列预测的层次结构
大数据·论文阅读·人工智能·深度学习·学习·机器学习·数据挖掘
数字化顾问8 小时前
(65页PPT)大型集团物料主数据管理系统建设规划方案(附下载方式)
大数据·运维·人工智能
老蒋新思维9 小时前
创客匠人 2025 全球创始人 IP+AI 万人高峰论坛:AI 赋能下知识变现与 IP 变现的实践沉淀与行业启示
大数据·人工智能·网络协议·tcp/ip·重构·创始人ip·创客匠人
河南博为智能科技有限公司10 小时前
高集成度国产八串口联网服务器:工业级多设备联网解决方案
大数据·运维·服务器·数据库·人工智能·物联网
无代码专家12 小时前
设备巡检数字化解决方案:构建高效闭环管理体系
java·大数据·人工智能
天远数科12 小时前
Node.js 原生加密指南:详解 Crypto 模块对接天远银行卡黑名单接口
大数据·api
expect7g12 小时前
Paimon Branch --- 流批一体化之二
大数据·后端·flink
天远云服12 小时前
高并发风控实践:AES 加密与银行卡风险标签清洗的 Go 语言实现
大数据·api