剩余磁盤空間達到es最小值,添加數據被block
PUT _all/_settings
{"index.blocks.read_only_allow_delete": null}
解除每次search最大10000size的限制
PUT [xxx]/_settings
{
"max_result_window" : 20000
}
刪除單個index全部內容
DELETE /new_listings_investment
{ "query": { "match_all": {} } }
ElasticSearch 索引 read-only 狀態恢復
最近在做 ES 壓測,當磁盤快滿時,所有索引會進入 read-only 狀態。數據無法繼續寫入,索引無法關閉,只能刪除索引。ES 官方文檔中對此種情況進行了說明.
如果使用 ES 的默認設置,ES 為了保持節點可用,設置了幾個存儲的安全值。分別為:
cluster.routing.allocation.disk.watermark.low: 默認 85% 當達到時,replica 不再寫入
cluster.routing.allocation.disk.watermark.high: 默認 90% 當達到時,shards 會嘗試寫入其他節點
cluster.routing.allocation.disk.watermark.flood_stage: 默認 95% 當達到時,所有索引變為 readonly狀態
所以遇到 read-only 狀態應該先檢查磁盤是否快滿了,此處可用通過 ES 日志查看。在釋放空間后,需要手動將每個索引的狀態修改過來,可以通過
put http://10.75.13.18:9200/_cluster/settings
{
"transient": {
"cluster.routing.allocation.disk.watermark.flood_stage": "98%"
}
}
1
2
3
4
5
修改索引的配置
put http://10.75.13.18:9200/xxx/_settings
{
"index.blocks.read_only_allow_delete": null
}