cluster_block_exception in Magento 2 – Webkul Blog

Here, we will provide a helpful solution to the ‘cluster_block_exception in Magento 2‘ thrown by Elasticsearch with indexing.

Indexing terminology

Dictionary : Original data entered to the system. It organises the Dictionaries in normal form to facilitate maintenance (updating the data).

Index : Representation of the original data for optimized reading and searching. Indexes can contain results of aggregations and various calculations. Index data can be always re-created from a dictionary using a certain algorithm.

Indexer : Object that creates an index.

To check the Index Management in magento 2 admin panel you have to follow following steps:

  1. Log in to the Admin.
  2. Click System > Tools > Index Management.

Indexing is how Adobe Commerce and Magento Open Source transform data such as products and categories, to improve the performance of your storefront. As data changes, the transformed data must be updated or reindexed. The application has a very sophisticated architecture that stores lots of merchant data (including catalog data, prices, users, and stores) in many database tables. To optimize storefront performance, the application accumulates data into special tables using indexers. But when you run the below reindex command:

bin/magento indexer:reindex

An error is shown in the terminal as follows:

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}

This means you do not have enough disk space to store or update data. This error is thrown by ElasticSearch when the flood storage watermark level is exceeded. It puts ElasticSearch into a read-only mode.

Now, I will provide the solution to the ‘cluster_block_exception’ in Magento 2

Steps to Solve ‘cluster_block_exception’ in Magento 2

We can solve the “disk usage exceeded flood-stage watermark” error while reindexing in Magento 2 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:

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:

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

After this again run the reindex command in the terminal and check.

You can also use our another blog to perform reindexing programmatically in magento 2 by clicking here.


Source link