Magento 2.4.2 – ElasticSearch Connection Guide

elasticsearchmagento2.4magento2.4.2reindex

I'm new to Magento2.4 and Elasticsearch. I'm having an issue in connecting them in server setup. This works fine in my local(Windows) setup. When I try to setup in the server, it is not working as intended.

  • OS – CentOS 8
  • Apache – 2.4
  • MariaDB – 15.1
  • PHP – 7.4
  • JAVA – 16.0
  • Elasticsearch – 7.9.3

While re-indexing the site, it works fine and all the details are saved in Elasticsearch. When I run curl, I'm able to get the details from it. But, while testing the connection from Magento Admin panel, it fails. Also, the category page is broken. it shows the error "Exception #0 (Elasticsearch\Common\Exceptions\NoNodesAvailableException): No alive nodes found in your cluster".

Edit 1 – I've updated the to config restarted elasticsearch, run the commands

magento setup:upgrade
magento setup:di:compile
magento setup:static-content:deploy -f
magento cache:flush

Still the issue persists.
enter image description here

Thanks in advance for helping me fix the issue. 🙂

Best Answer

You can check your elastic search host name alternatively by typing

localhost:9200

Once you get the results as shown in the screen shot, you can copy the host name from there which is highlighted in the attached screen shot. I faced the similar problem and fixed by changing the host name.

host name

Related Topic