0

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. :)

1
  • are you using the load balancer? Aug 30 at 16:09
0

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

0

Goto stores->configuration->catalog->catalog Search than select search engine as elastic search

  • Elasticsearch Server Hostname: localhost
  • Elasticsearch Server Port: 9200
  • Elasticsearch Index Prefix: magento2
  • Enable Elasticsearch HTTP Auth: No
  • Elasticsearch Server: Timeout

than restart elasticsearch server and click on test connection if shows success message than it works fine

good luck

2
0

You need to configure Elasticsearch with Apache Server Link are given below

Configure Elastic search with apache or nginx https://devdocs.magento.com/guides/v2.4/install-gde/prereq/es-config-apache.html

0

please execute the below commands from your Magento root terminal

php bin/magento config:set catalog/search/engine elasticsearch7
php bin/magento config:set catalog/search/elasticsearch7_server_hostname localhost
php bin/magento config:set catalog/search/elasticsearch7_server_port 9200

now for testing

curl -i https://example.com:8080/_cluster/heath

Here 8080 is the port in which your site is running.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.