当我尝试在elasticsearch中存储任何内容时,出现错误:
TransportError(403, u'cluster_block_exception', u'blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];')
我已经在索引中插入了大约2亿个文档。但我不知道为什么会发生这种错误。我试过了:
curl -u elastic:changeme -XPUT 'localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{"persistent":{"cluster.blocks.read_only":false}}'
如上所述:ElasticSearch entered "read only" mode, node cannot be altered
结果是:
{"acknowledged":true,"persistent":{"cluster":{"blocks":{"read_only":"false"}}},"transient":{}}
但没有改变。我该怎么办?
试试GET yourindex/_settings
,这将显示你的索引设置。如果read_only_allow_delete
是true
,那么试试:
PUT /<yourindex>/_settings
{
"index.blocks.read_only_allow_delete": null
}
我解决了我的问题。
请参阅es config guide了解更多细节。
上个月我遇到了同样的问题,你可以在你的Kibana Dev Tools上试试这个代码
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
我希望它有所帮助
当我的磁盘空间已满时,我遇到了同样的问题,
请看看我做的步骤
1-增加磁盘空间
2-更新索引只读模式,请参阅以下curl请求
curl -XPUT -H“Content-Type:application / json”http://localhost:9200/_all/_settings -d'{“index.blocks.read_only_allow_delete”:null}'
问题可能是磁盘空间问题,我有这个问题,尽管我清理了很多空间我的磁盘,所以,最后我删除数据文件夹,它工作:sudo rm -rf /usr/share/elasticsearch/data/