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

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

相关推荐
tiannian122015 分钟前
如何选择适合企业的RFID系统解决方案?
大数据·人工智能
程途拾光1581 小时前
绿色AI与低功耗推理架构
大数据·人工智能
G皮T1 小时前
【Elasticsearch】查询性能调优(三):track_total_hits 和 terminate_after 可能的冲突
大数据·elasticsearch·搜索引擎·全文检索·索引·性能·opensearch
川西胖墩墩1 小时前
中文PC端跨职能流程图模板免费下载
大数据·论文阅读·人工智能·架构·流程图
TDengine (老段)2 小时前
TDengine 企业用户建表规模有多大?
大数据·数据库·物联网·时序数据库·iot·tdengine·涛思数据
Hello.Reader2 小时前
Flink ML MinMaxScaler 把特征缩放到统一区间 [min, max]
大数据·人工智能·flink
QT 小鲜肉3 小时前
【Linux命令大全】001.文件管理之lsattr命令(实操篇)
linux·运维·服务器·笔记·elasticsearch
许泽宇的技术分享3 小时前
2025年度技术之旅:在AI浪潮下的个人突破、持续创作与平衡之道
大数据·人工智能
Sui_Network3 小时前
智能体支付时代:Sui 为 AI 构建可验证的金融基础设施
大数据·人工智能·游戏·金融·rpc·区块链·量子计算
一条闲鱼_mytube3 小时前
Github+Jenkins + Harbor CI/CD 指南
ci/cd·github·jenkins