ES插入大量的数据时报错:TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block 的解决方法 原因: 是因为一次请求中批量插入的数据条数巨多,以及短时间内的请求次数巨多引起ES节点服务器内存超过限制,ES主动给索引上锁。 解决方法:
PUT _all/_settings
{
"index.blocks.read_only_allow_delete": null
}
解决 紧急给Elasticsearch的硬盘扩容,扩容完毕后执行以下语句关闭索引的只读状态:
PUT _all/_settings
{
? "index.blocks.read_only_allow_delete": null
}
如果来不及给Elasticsearch硬盘扩容,可以先关闭磁盘分配保护,让最后仅有的5%的磁盘空间缓冲一点时间,然后再给硬盘扩容。
关闭磁盘分配保护
PUT _cluster/settings
{
? "transient": {
? ? "cluster.routing.allocation.disk.threshold_enabled": false
? }
}
关闭索引的只读状态
PUT _all/_settings
{
? "index.blocks.read_only_allow_delete": null
}
#! this request accesses system indices: [.apm-agent-configuration, .apm-custom-link, .async-search, .kibana_1, .kibana_7.12.0_001, .kibana_task_manager_1, .kibana_task_manager_7.12.0_001, .reporting-2019.12.01, .reporting-2020.11.08, .reporting-2020.12.06, .reporting-2021-11-07, .security-7, .tasks], but in a future major version, direct access to system indices will be prevented by default
{
"acknowledged" : true
}
磁盘扩容完毕后,启用磁盘分配保护
PUT _cluster/settings
{
? "transient": {
? ? "cluster.routing.allocation.disk.threshold_enabled": true
? }
}
|