解決Elasticsearch索引只讀(read-only)


原因為:es 的設置默認是 85% 和 90 %,95%

當為85%時:Elasticsearch不會將碎片分配給磁盤使用率超過85%的節點( cluster.routing.allocation.disk.watermark.low)

當為90%時:Elasticsearch嘗試重新分配給磁盤低於使用率90%的節點(cluster.routing.allocation.disk.watermark.high)

當為85%時:Elasticsearch執行只讀模塊(cluster.routing.allocation.disk.watermark.flood_stage)

1、擴大磁盤或者刪除部分歷史索引

2、重置改只讀索引快

某一個索引重置只讀模塊
PUT /twitter/_settings { "index.blocks.read_only_allow_delete": null }
所有索引重置只讀模塊
PUT /_all/_settings { "index.blocks.read_only_allow_delete": null }
PUT /_cluster/settings
{
  "persistent" : {
    "cluster.blocks.read_only" : false } }

修改默認設置

可以修改為具體的磁盤空間值,也可以修改為百分之多少
臨時修改
PUT _cluster/settings { "transient": { "cluster.routing.allocation.disk.watermark.low": "100gb", "cluster.routing.allocation.disk.watermark.high": "50gb", "cluster.routing.allocation.disk.watermark.flood_stage": "10gb", "cluster.info.update.interval": "1m" } }
永久修改
PUT _cluster/settings { "persistent": { "cluster.routing.allocation.disk.watermark.low": "100gb", "cluster.routing.allocation.disk.watermark.high": "50gb", "cluster.routing.allocation.disk.watermark.flood_stage": "10gb", "cluster.info.update.interval": "1m" } }
 

轉載自:https://www.elastic.co/guide/en/elasticsearch/reference/6.8/disk-allocator.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM