Elasticsearch problem - Cluster Block Exception
I experienced this issue "cluster_block_exception" when I did a DI compilation and other during re-indexing.
/*di compile command*/
bin/magento setup:di:compile
/*re-indexing command*/
bin/magento indexer:reindex
The main cause of this problem is Elasticsearch that magento is using as search engine module.
1. First solution would be to check if elasticsearch is even running otherwise try to restart again.
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch
then try to check if its successful by entering this command in your terminal (assuming elasticsearch is running 9200 port).
curl -X GET 'http://localhost:9200'
The test if successful should return valid json values:
{
"name" : "ubuntu",
"cluster_name" : "elasticsearch",
"cluster_uuid" : {uuid values},
"version" : {
"number" : {version number},
"build_flavor" : "defaulyt",
...
},
"tagline" : "You Know, for Search"
}
2. If the first solution is not working then try this second solution:
Run the following command in your terminal (assuming that elasticsearch is running 9200 port).
$ curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_cluster/settings -d '{ "transient": { "cluster.routing.allocation.disk.threshold_enabled": false } }'
$ curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'