Solved: cluster_block_exception [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block] in Magento 2
Hello readers,
I am back with a helpful solution to the ‘cluster block exception in Magento 2‘ thrown by Elasticsearch.
Recently, I stumbled upon an unforeseen error while reindexing in the Magento 2 store of one of my clients. In order to issue a reindex in Magento 2, I ran the following command:
1 |
bin/magento indexer:reindex |
However, the result was unexpected. 😑
The terminal threw the following error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid index has been rebuilt successfully in 00:00:05 Category Flat Data index has been rebuilt successfully in 00:00:00 Category Products index has been rebuilt successfully in 00:00:06 Product Categories index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:00 Product EAV index has been rebuilt successfully in 00:00:09 Stock index has been rebuilt successfully in 00:00:04 Inventory index has been rebuilt successfully in 00:00:00 Catalog Product Rule index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:01:57 Google Product Removal Feed index has been rebuilt successfully in 00:00:00 Google Product Feed index has been rebuilt successfully in 00:00:00 Catalog Search index process unknown error: {"error":{"root_cause":[{"type":"cluster_block_exception","reason":"index [magento2_product_1_v1516] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];"}],"type":"cluster_block_exception","reason":"index [magento2_product_1_v1516] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];"},"status":429} |
On further investigation, I came to know that ElasticSearch was the causative factor in the above case and was throwing the “cluster_block_exception” error due to low disk space. This error is thrown by ElasticSearch when the flood storage watermark level is exceeded. It puts ElasticSearch into a read-only mode.
In this post, I will provide the step-wise solution to the ‘cluster block exception’ in Magento 2.
Method to Solve ‘cluster block exception’ in Magento 2
The “disk usage exceeded flood-stage watermark” error while reindexing in Magento 2 can be solved by disabling the cluster routing allocation disk threshold. You can follow the steps mentioned below to solve the ‘cluster block exception’ in Magento 2:
Step 1: Run the following command in the root path of Magento 2:
1 |
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d '{ "transient": { "cluster.routing.allocation.disk.threshold_enabled": false } }' |
Step 2: Try to perform reindexing again using the following command:
1 |
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}' |
That’s it!
Magento 2 will perform the reindexing normally again! 🚀
You can also use the programmatic method to perform reindexing in Magento 2 after solving the issue using this solution.
In case you are still facing any issues or have any queries regarding the provided solution, please feel free to comment. Also, do not forget to share this solution with your Magento friends via social media. 😇
Thanks for reading. 🍀
2 Comments
Thank you!
Thank You for you valuable feedback!