« 全站切换为 UTF-8 更新到 Movable Type 8.8.1 |
Main
December 19, 2025
Elasticsearch 当分区满时 临时调整下
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。
https://windtear.net/2025/12/elasticsearch.html
PUT _cluster/settings
{
"transient": {
"cluster.routing.allocation.disk.watermark.low": "97%",
"cluster.routing.allocation.disk.watermark.high": "98%",
"cluster.routing.allocation.disk.watermark.flood_stage": "99%"
}
}
This Elasticsearch API command updates the cluster's disk-based shard allocation settings. These watermarks prevent the cluster from running out of storage by managing shard placement.
Effect of These Settings
The command applies the following thresholds as transient settings, meaning they take effect immediately but will reset after a cluster restart:
Low Watermark (97%): Shards will no longer be allocated to nodes with more than 97% disk usage.
High Watermark (98%): Elasticsearch will actively attempt to relocate existing shards away from any node exceeding 98% disk usage.
Flood Stage Watermark (99%): If a node exceeds 99%, all indices with shards on that node will be blocked from further writes and marked read-only.
Key Considerations
Safety Risk: These values are significantly higher than the defaults (85%, 90%, 95%). Running a disk at 99% capacity is risky and can lead to immediate system instability or data corruption if the remaining 1% is exhausted.
Clearing Read-Only Blocks: If your indices are already in a read-only state due to a previous watermark breach, updating the settings alone may not be enough. In versions before Elasticsearch 7.4, you must manually reset the block using:
bash
PUT /_all/_settings
{
"index.blocks.read_only_allow_delete": null
}
请谨慎使用此类代码。
Persistent vs. Transient: To make these changes permanent across restarts, use the "persistent" key instead of "transient".
|
|
Posted by windtear at December 19, 2025 12:25 AM