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

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

相关推荐
ganshenml9 小时前
【GIT】Git 本地无法识别远程分支的原因与解决方法 not a valid ref
大数据·git·elasticsearch
火山引擎开发者社区10 小时前
DeepSeek-V3.2正式登陆火山方舟
大数据·人工智能
jqpwxt10 小时前
启点创新山水景区智慧旅游SAAS平台,智慧景区售检票系统,景区门票管理系统
大数据·旅游
陀螺财经11 小时前
加密热潮“席卷”美国军界
大数据·人工智能·区块链
打码人的日常分享12 小时前
智慧城市一网统管建设方案,新型城市整体建设方案(PPT)
大数据·运维·服务器·人工智能·信息可视化·智慧城市
Sui_Network12 小时前
21shares 在纳斯达克推出 2 倍 SUI 杠杆 ETF(TXXS)
大数据·人工智能·游戏·金融·区块链
龙亘川12 小时前
开箱即用的智慧城市一网统管 AI 平台——功能模块详解(3)
大数据·人工智能·智慧城市·智慧城市一网统管 ai 平台
dragonzoebai13 小时前
ol加载互联网瓦片大于18级时空白
大数据
AI营销快线13 小时前
AI营销下半场:B2B选型指南
大数据·人工智能
一只专注api接口开发的技术猿14 小时前
构建电商数据中台:基于淘宝 API 关键词搜索接口的设计与实现
大数据·开发语言·数据库