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

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

相关推荐
eastyuxiao7 小时前
思维导图拆解项目范围 3 个真实落地案例
大数据·运维·人工智能·流程图
Meya112712 小时前
别再人工硬扛机房管理!智能 U 位系统,让机房管理一键数字化
大数据·运维
天辛大师13 小时前
天辛大师谈人工智能时代,如何用AI研究历代放生劝善忏悔文
大数据·人工智能·随机森林·启发式算法
为儿打call13 小时前
SparkSQL 广播超时排查:小表但是多分区 = BroadcastTimeout
大数据·spark
eastyuxiao13 小时前
如何用思维导图拆解项目范围
大数据·人工智能·流程图
渣渣盟13 小时前
Apache Flink物理分区算子全解析
大数据·flink·apache
小王毕业啦14 小时前
(1990-2024年)个股交易活跃度、个股换手率
大数据·人工智能·数据挖掘·数据分析·区块链·社科数据
N串14 小时前
2.7 公司内部的“阶级”是什么
大数据·人工智能
lizhihai_9915 小时前
股市学习心得—商业航天10大核心材料供应商
大数据·人工智能·学习
app软件定制开发1737709107215 小时前
世界杯应用开发的关键要点与注意事项
大数据·区块链