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

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

相关推荐
Java面试题总结7 分钟前
robots.txt 完全指南:从入门到精通
大数据
SNKXD_114 分钟前
避开选型认知误区:2026年实测8款智能AI数字人平台总结筛选标准
大数据·人工智能·机器学习
Spider Cat 蜘蛛猫14 分钟前
Keycloak私有化部署落地Shopify类跨境SaaS独立站完整方案
大数据
AC赳赳老秦34 分钟前
GTD 工作法落地:用 OpenClaw 搭建收集-整理-执行-复盘全流程自动化工作流
大数据·运维·人工智能·信息可视化·自动化·deepseek·openclaw
DataX_ruby8240 分钟前
DCMM 2.0 贯标评估全解读:数据中台如何支撑九大能力域(2026版)
大数据·运维·人工智能·数据治理·数据中台
Leo.yuan1 小时前
数据目录和数据字典有什么区别?一文讲清
大数据·数据库·人工智能
m0_466525292 小时前
公积金弹性调整:科技行业穿越周期的理性选择
大数据·人工智能·科技
数智化管理手记2 小时前
财务大数据怎么支撑经营决策?财务大数据分析包含哪些维度
大数据·数据挖掘·数据分析
薛定猫AI2 小时前
【深度解析】动态多智能体团队:并行规划、开发与验证的 Python 实战
大数据·开发语言·python
工具派4 小时前
从 git commit 到交付 PDF:我的一条在线工具流实录
git·elasticsearch·pdf