当尝试将文档发布到Elasticsearch时,我得到了这个错误:

cluster_block_exception [FORBIDDEN/12/index read-only / allow delete (api)];

我还在Elasticsearch日志中看到了这样的消息:

flood stage disk watermark [95%] exceeded ... all indices on this node will marked read-only

当前回答

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

FROM

https://techoverflow.net/2019/04/17/how-to-fix-elasticsearch-forbidden-12-index-read-only-allow-delete-api/

其他回答

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

FROM

https://techoverflow.net/2019/04/17/how-to-fix-elasticsearch-forbidden-12-index-read-only-allow-delete-api/

ELK团队的一个很好的指南:

https://www.elastic.co/guide/en/elasticsearch/reference/master/disk-usage-exceeded.html

我用ELK 7.x就能做到

当您的机器磁盘空间不足时,通常会观察到此错误。 要避免此错误消息所遵循的步骤

Resetting the read-only index block on the index: $ curl -X PUT -H "Content-Type: application/json" http://127.0.0.1:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}' Response ${"acknowledged":true} Updating the low watermark to at least 50 gigabytes free, a high watermark of at least 20 gigabytes free, and a flood stage watermark of 10 gigabytes free, and updating the information about the cluster every minute Request $curl -X PUT "http://127.0.0.1:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d' { "transient": { "cluster.routing.allocation.disk.watermark.low": "50gb", "cluster.routing.allocation.disk.watermark.high": "20gb", "cluster.routing.allocation.disk.watermark.flood_stage": "10gb", "cluster.info.update.interval": "1m"}}' Response ${ "acknowledged" : true, "persistent" : { }, "transient" : { "cluster" : { "routing" : { "allocation" : { "disk" : { "watermark" : { "low" : "50gb", "flood_stage" : "10gb", "high" : "20gb" } } } }, "info" : {"update" : {"interval" : "1m"}}}}}

运行这两个命令后,必须再次运行第一个命令,以使索引不会再次进入只读模式

仅使用以下命令更改设置在我的环境中不起作用:

curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'

我还必须运行强制合并API命令:

curl -X POST "localhost:9200/my-index-000001/_forcemerge?pretty"

参考:强制合并API

从PostMan中删除只读设置