解决 Elasticsearch 报错 flood stage disk watermark 磁盘满只读
解决 Elasticsearch 节点磁盘使用率超过 95% 触发只读保护的排查方法,提供磁盘清理与 read_only_allow_delete 解除步骤。
问题现象
向 Elasticsearch 写入数据时全部报错失败:
{
"error": {
"root_cause": [
{
"type": "cluster_block_exception",
"reason": "index [my_index] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete blocks];"
}
],
"type": "cluster_block_exception",
"reason": "index [my_index] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete blocks];"
},
"status": 429
}
触发根因
- Elasticsearch 节点磁盘使用率超过了熔断水位线
flood_stage(默认 95%)。 - 为了防止磁盘彻底耗尽损坏 Lucene 索引文件,ES 自动将所有索引设置为只读保护模式(
read_only_allow_delete: true)。
解决步骤与操作命令
步骤一:清理宿主机磁盘或删除旧索引释放空间
登录节点排查磁盘占用:
df -h
删除已经归档或废弃的旧索引:
curl -X DELETE "http://localhost:9200/logs-2026-10-*"
步骤二:手动解除集群与索引的只读锁定
当磁盘使用率回落到 95% 以下后,执行 API 解除全局只读状态:
curl -X PUT "http://localhost:9200/_settings" -H 'Content-Type: application/json' -d'
{
"index.blocks.read_only_allow_delete": null
}
'
步骤三:按需调优集群水位线(可选)
针对大容量磁盘(例如 10TB 磁盘),可将固定百分比改为按剩余可用容量配置:
curl -X PUT "http://localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d'
{
"persistent": {
"cluster.routing.allocation.disk.watermark.low": "85%",
"cluster.routing.allocation.disk.watermark.high": "90%",
"cluster.routing.allocation.disk.watermark.flood_stage": "95%",
"cluster.info.update.interval": "1m"
}
}
'
验证确认
验证索引可写状态:
curl -X POST "http://localhost:9200/my_index/_doc" -H 'Content-Type: application/json' -d '{"test": "ok"}'
返回 {"result": "created"},索引成功恢复正常读写能力。


