管理磁盘水位线并解除 flood-stage 写入阻塞
Elasticsearch集群/节点命令
GET _cat/allocation?v&h=node,shards,disk.indices,disk.used,disk.avail,disk.percent&s=disk.percent:desc
GET _cluster/settings?include_defaults=true&filter_path=*.cluster.routing.allocation.disk
# Adjust thresholds temporarily (null returns to the default):
PUT _cluster/settings
{
"persistent": {
"cluster.routing.allocation.disk.watermark.low": "85%",
"cluster.routing.allocation.disk.watermark.high": "90%",
"cluster.routing.allocation.disk.watermark.flood_stage": "95%"
}
}
# After freeing space, remove the flood-stage write block:
PUT _all/_settings
{
"index.blocks.read_only_allow_delete": null
}作用
显示每个节点的磁盘使用情况和实际生效的水位线值;调整 low/high/flood_stage 阈值,并解除在 flood stage 时施加到索引上的 read_only_allow_delete 阻塞。
适用场景
写入被拒绝并报 'TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block'、新分片未被分配,或分片开始从已满节点迁出时。
注意
超过 low 时不再向该节点分配新分片;超过 high 时分片会从该节点迁出;超过 flood_stage 时,在该节点上有分片的索引会变为只读。提高阈值只能争取时间;持久的解决办法是删除旧索引、减少副本或增加磁盘/节点。若磁盘完全写满,分片可能损坏。