es 剩余磁盘空间达到es最小值,添加数据被block

剩余磁盘空间达到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
}

原文地址:https://www.cnblogs.com/gaoyuechen/p/10178718.html