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

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

相关推荐
HaiLang_IT2 分钟前
2026 人工智能与大数据专业毕业论文选题方向及题目示例(nlp/自然语言处理/图像处理)
大数据·人工智能·毕业设计选题
呆呆小金人12 分钟前
SQL键类型详解:超键到外键全解析
大数据·数据库·数据仓库·sql·数据库开发·etl·etl工程师
StarRocks_labs27 分钟前
StarRocks 4.0:基于 Apache Iceberg 的 Catalog 中心化访问控制
大数据·apache
梦子yumeko1 小时前
第六章langchain4j之Tools和prompt
大数据·prompt
AcrelGHP2 小时前
光储充微电网能量管理系统:构建绿色、高效、安全的能源未来
大数据·运维·人工智能
wudl55662 小时前
Flink RocksDB State Backend 详解
大数据·flink
Hello.Reader2 小时前
用一份 YAML 编排实时数据集成Flink CDC 工程实践
大数据·flink
不二人生2 小时前
从 Flink 到 Doris 的实时数据写入实践 —— 基于 Flink CDC 构建更实时高效的数据集成链路
大数据·flink·cdc
罗不俷2 小时前
【Hadoop】Hadoop 起源与核心组件解析 —— 大数据时代的分布式基石
大数据·hadoop·分布式
Hello.Reader3 小时前
用 Flink CDC 将 MySQL 实时同步到 Doris
大数据·mysql·flink