Skip to content

What is the correct configuration using opensearch and magento

I have a basic setup of Magento & Open search.

I have been following the guide here https://experienceleague.adobe.com/docs/commerce-operations/installation-guide/overview.html?lang=en

In the guide it is recommended to install open search so I did so following this guide:
https://opensearch.org/docs/latest/install-and-configure/install-opensearch/docker/

Under the quick installation section titled “Install the application” in the magento guide, there is an example command:

bin/magento setup:install 
--base-url=http://localhost/magento2ee 
--db-host=localhost 
--db-name=magento 
--db-user=magento 
--db-password=magento 
--admin-firstname=admin 
--admin-lastname=admin 
[email protected] 
--admin-user=admin 
--admin-password=admin123 
--language=en_US 
--currency=USD 
--timezone=America/Chicago 
--use-rewrites=1 
--search-engine=opensearch 
--opensearch-host=os-host.example.com 
--opensearch-port=9200 
--opensearch-index-prefix=magento2 
--opensearch-timeout=15

Unfortunately this doesn’t work, I get the error:

Could not validate connection to OpenSearch. No alive nodes found in your cluster.

This is strange because when using docker ps I can see three nodes, one for the dashboard and two for search.

CONTAINER ID   IMAGE                                            COMMAND                  CREATED       STATUS       PORTS                                                                                                      NAMES
4aaed976caf1   opensearchproject/opensearch:latest              "./opensearch-docker…"   3 hours ago   Up 3 hours   9200/tcp, 9300/tcp, 9600/tcp, 9650/tcp                                                                     opensearch-node2
8a6e26709a6b   opensearchproject/opensearch-dashboards:latest   "./opensearch-dashbo…"   3 hours ago   Up 3 hours   0.0.0.0:5601->5601/tcp, :::5601->5601/tcp                                                                  opensearch-dashboards
31e3e15d8ae0   opensearchproject/opensearch:latest              "./opensearch-docker…"   3 hours ago   Up 3 hours   0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 9300/tcp, 0.0.0.0:9600->9600/tcp, :::9600->9600/tcp, 9650/tcp   opensearch-node1

I tried changing the host name to localhost, 127.0.0.1, 0.0.0.0, opensearch, opensearch-node1, opensearch-node2, opensearch-cluster and some others but none of them work.

Any ideas on how to point magento to the docker cluster?