解决 Fluent Bit 报错 HTTP 403 index has read-only-allow-delete
分析 Fluent Bit 向 ES 推送日志报 403 read-only-allow-delete 诱因,详解 Elasticsearch 磁盘水位限制解除与自动清理配置方案。
问题现象
Fluent Bit 日志采集客户端向 Elasticsearch 写入日志批次时被全部拒绝,日志中持续打印错误:
[error] [output:es:es.0] HTTP status=403 URI=/_bulk, response:
{"error":{"root_cause":[{"type":"cluster_block_exception","reason":"index [k8s-logs-2026.11.15] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete];"}],"type":"cluster_block_exception","reason":"index [k8s-logs-2026.11.15] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete];"},"status":403}
Fluent Bit 内存队列积压并触发丢弃策略。
触发根因
- Elasticsearch 磁盘使用率突破 95% 洪水水位线(Flood-stage Watermark):ES 启动自我保护机制,强行为所有现有索引和新索引加上
read_only_allow_delete锁,拒绝任何新文档追加。 - 磁盘空间清理后未手动执行 API 解锁:即便删除了旧文件释放了磁盘,ES 不会自动移除已锁定索引的只读标记。
诊断排查步骤
- 检查 Elasticsearch 各节点物理磁盘使用百分比:
curl -s http://elasticsearch:9200/_cat/allocation?v
查看 disk.percent 列。
解决步骤与操作命令
步骤一:删除无用的历史旧索引释放存储
通过命令行删除 14 天前的旧索引:
curl -X DELETE "http://elasticsearch:9200/k8s-logs-2026.10.*"
步骤二:调用 API 手动解除全集群索引的只读锁(关键操作)
curl -X PUT "http://elasticsearch:9200/_all/_settings" -H "Content-Type: application/json" -d '{
"index.blocks.read_only_allow_delete": null
}'
步骤三:适度调整水位线阈值(针对高容量大盘)
在 elasticsearch.yml 中调整绝对数值或更高比例:
cluster.routing.allocation.disk.watermark.low: 85%
cluster.routing.allocation.disk.watermark.high: 90%
cluster.routing.allocation.disk.watermark.flood_stage: 95%
验证方法
观察 Fluent Bit 最新采集日志:
journalctl -u fluent-bit -n 50 --no-pager
日志中不再出现 HTTP 403 报错,取而代之的是 [output:es] bulk flushed successfully,数据重新流入 Kibana。


