ES报错 [FORBIDDEN/12/index read-only / allow delete (api)] - read only elasticsearch indices

Our company mainly uses ElasticSearch as NOSQL. An error was reported today. Check the error log as follows. ElasticSearch enters "read-only" mode, and the node cannot be changed

Config: Error 403 Forbidden: blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];: [cluster_block_exception] blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];

Troubleshooting

Check the official Elasticsearch documentation, the original text is as follows:


Elasticsearch considers the available disk space on a node before deciding whether to allocate new shards to that node or to actively relocate shards away from that node.

Elasticsearch will first determine whether the storage space of the node is sufficient before deciding whether to allocate a new shard to the node or relocate the shard to the node. If your used disk space exceeds 95%, ES will automatically index the index Set to read-only state.
but! ! ! ! ! Check that the disk space of Elasticsearch storage directory and log directory is enough,

Solve the problem

Before the Elasticsearch disk was full, it was in a read-only state, or there was a network fluctuation problem, and the index in the read-only state could only be queried or deleted. And ES will not automatically switch back the index status, so we need to manually switch:

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

Just submit 127.0.0.1:9200 as your ip

Welcome to follow WeChat public account

Insert picture description here

**

Guess you like

Origin blog.csdn.net/CharlesYooSky/article/details/113111627