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

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

相关推荐
goujunwe几秒前
电商品牌 GEO:让 AI 在消费者对比产品时,采信你的品牌信息
大数据·人工智能
IT研究室1 小时前
最新大数据毕业设计选题推荐-基于大数据的人工智能社交媒体情绪分析与可视化的设计与实现-大数据-Spark-Hadoop-Bigdata
大数据·人工智能·课程设计
Data-Miner1 小时前
离线AI制表:模型适配与脚本固化实操
大数据·数据库·人工智能·excel
梦想画家1 小时前
SQLMesh 告警实战:只用 YAML 配置和 SQL 模型,搭一套数据管道告警
大数据·数据开发·sqlmesh
段一凡-华北理工大学1 小时前
高炉炼铁机器视觉与智能识别十八讲~系列文章05:炉顶料面识别:装料分布判读与布料制度优化
大数据·人工智能·机器视觉·工业智能化·高炉炼铁智能化·高炉炉顶料面识别
sbjdhjd2 小时前
智能体开始“动手”之后:OpenAI越权事件、Anthropic算力资本化与开放权重模型竞逐 | AI与SI行业日报整理(9月29日—10月6日)
大数据·人工智能·经验分享·笔记·ai·chatgpt·开源
2601_962780912 小时前
数学与应用数学投递供应链计划岗,短板补齐与项目搭建方案
大数据
品牌常新2 小时前
GEO哪家好?2026年服务商选型与能力对比
大数据·人工智能
keke.shengfengpolang2 小时前
2027届数学专业转策略产品助理:从指标拆解到AB实验的知识补齐路径
大数据
ly76892 小时前
Elasticsearch 写入链路的 refresh、flush 与 translog 边界:为什么 bulk 吞吐会突然塌陷
大数据·elasticsearch·搜索引擎·translog·写入链路·bulk调优