如何修复 ElasticSearch [FORBIDDEN/12/index read-only / allow delete (api)]
如果你尝试在 ElasticSearch 中索引文档并看到类似这样的错误消息:
elasticsearch-error.txt
elasticsearch.exceptions.AuthorizationException: AuthorizationException(403, 'cluster_block_exception', 'blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];')你可以使用以下命令解锁对集群(所有索引)的写入
elasticsearch-unlock.sh
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'(感谢 StackOverflow 上的 Imran273 提供原始解决方案)
但请注意通常有导致 ElasticSearch 锁定索引写入的潜在原因。最常见的是由超出磁盘水位线/配额引起的。请参见如何禁用 ElasticSearch 磁盘配额/水位线了解如何解决此问题的详情。
Check out similar posts by category:
Databases, ElasticSearch
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow