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

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

相关推荐
一勺-_-3 分钟前
.git文件夹
大数据·git·elasticsearch
秋刀鱼 ..2 小时前
2026年电力电子与电能变换国际学术会议 (ICPEPC 2026)
大数据·python·计算机网络·数学建模·制造
G皮T3 小时前
【Elasticsearch】 大慢查询隔离(一):最佳实践
大数据·elasticsearch·搜索引擎·性能调优·索引·性能·查询
expect7g4 小时前
Paimon源码解读 -- Compaction-6.CompactStrategy
大数据·后端·flink
武子康5 小时前
大数据-183 Elasticsearch - 并发冲突与乐观锁、分布式数据一致性剖析
大数据·后端·elasticsearch
Hello.Reader5 小时前
Flink SQL Top-N 深度从“实时榜单”到“少写点数据”
大数据·sql·flink
梦里不知身是客115 小时前
Combiner在mapreduce中的作用
大数据·mapreduce
ha_lydms6 小时前
Spark函数
大数据·分布式·spark
相思半6 小时前
机器学习模型实战全解析
大数据·人工智能·笔记·python·机器学习·数据挖掘·transformer
要站在顶端7 小时前
Jenkins PR编号提取&环境变量赋值问题总结
java·servlet·jenkins