8

I'm trying to install Magento open source for the first time.
I have gone through most of the process except the last part. When I try to run:
php bin/magento setup:install --base-url=http://localhost/magento2ee --db-host=localhost --db-name=magento2 --db-user=root --db-password= --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 or :

--base-url=http://localhost/magento2ee \
--db-host=localhost \
--db-name=magento2 \
--db-user=root \
--db-password= \
--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

from the Magento documentation, I get the following error:

In SearchConfig.php line 81:

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

I tried checking the source of the issue by testing OpenSearch, and sent couple of requests and it is working:

curl.exe -X GET http://localhost:9200

returned:

{
"name" : "DESKTOP-HD81RFN",
"cluster_name" : "opensearch",
"cluster_uuid" : "HwWhh2IyRIWI_C952vAbkg",
"version" : {
"distribution" : "opensearch",
"number" : "2.6.0",
"build_type" : "zip",
"build_hash" : "7203a5af21a8a009aece1474446b437a3c674db6",
"build_date" : "2023-02-24T19:18:51.456570800Z",
"build_snapshot" : false,
"lucene_version" : "9.5.0",
"minimum_wire_compatibility_version" : "7.10.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "The OpenSearch Project: https://opensearch.org/"
}

same result when I check http://localhost:9200/ on my browser.

Another test I did was sending:netstat -ano | find "9200" to see if OpenSearch is listening to the requests on the port, and it is:

TCP    0.0.0.0:9200           0.0.0.0:0              LISTENING       7148
TCP    [::]:9200              [::]:0                 LISTENING       7148
TCP    [::1]:9200             [::1]:64743            ESTABLISHED     7148
TCP    [::1]:64743            [::1]:9200             ESTABLISHED     2125

Now I don't know the possible source of the issue.

6 Answers 6

14

Replace --search-engine=opensearch with --search-engine= elasticsearch7, it will solve your issue.

It is intended to bypass the Magento installation/upgrade process, you can change the configuration for the search engine back to OpenSearch afterward by running:

bin/magento config:set catalog/search/engine 'opensearch'

This is an installation/upgrade issue in Magento 2.4.6, see https://github.com/magento/magento2/issues/37236

6
  • the search engine im using is not elasticsearch7 but rather opensearch, thats why i made it opensearch. do i uninstall opensearch and switch to elasticsearch?
    – Adnane Rbt
    Commented Apr 11, 2023 at 16:51
  • No, you don't need. Just use that modification during setup/upgrade Magento, you can switch it back to opensearch after that by running: bin/magento config:set catalog/search/engine 'opensearch'
    – Tu Van
    Commented Apr 11, 2023 at 17:57
  • 1
    thanks a lot, worked for me, have other issues now, but it stopped on this one
    – Adnane Rbt
    Commented Apr 11, 2023 at 20:56
  • @AdnaneRbt You're welcome. Could you confirm which Magento version you are installing?
    – Tu Van
    Commented Apr 11, 2023 at 21:04
  • 1
    yes, it's : "version": "2.4.6" can update aswell with the other issues i had until it worked and the solutions i found if you want
    – Adnane Rbt
    Commented Apr 11, 2023 at 21:30
13

By default OpenSearch uses SSL, but magento doesn't use it. So it needs to disable SSL plugin in OpenSearch for successful magento installation:

sudo nano /etc/opensearch/opensearch.yml

And add this to the end of yml file:

plugins.security.disabled: true

I get it from there.

2
  • You also need to un-commet the line: http.port: 9200, for opensearch to listen to an insecure port Commented Sep 28, 2023 at 5:26
  • The comment from Dallas is correct. You need to do this as well.
    – Christian
    Commented Oct 5, 2023 at 5:53
3

Try changing --opensearch-host=os-host.example.com
to --opensearch-host=localhost \

HTH, Tom

4
  • i tried with your suggestion and it returned ``` No arguments expected for "setup:install" command, got "\--base-url=localhost/magento2ee" ```
    – Adnane Rbt
    Commented Apr 11, 2023 at 12:18
  • Please post your complete setup:install command with all the parameters. The parameter "opensearch-host" should be set to localhost. Commented Apr 11, 2023 at 12:40
  • php bin/magento setup:install --base-url=http://localhost/magento2ee \--db-host=localhost \--db-name=magento2 \--db-user=root \--db-password= \--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=localhost \--opensearch-port=9200 \--opensearch-index-prefix=magento2 \--opensearch-timeout=15
    – Adnane Rbt
    Commented Apr 11, 2023 at 14:44
  • for the time being this worked for me, that's why it was weird to me to see localhost/magento2ee
    – medmek
    Commented Apr 13 at 17:11
1

This problem is possibly caused by incorrect configuration of opensearch in core_config_data. Try running the following commands in your SQL console:

update core_config_data set value = "opensearch" where path = "catalog/search/opensearch_server_hostname";

update core_config_data set value = "opensearch" where path = "catalog/search/engine";

update core_config_data set value = "9200" where path = "catalog/search/opensearch_server_port";
1
  • Using opensearch as hostname did the trick for me. Thank you!
    – codephunk
    Commented Oct 24, 2023 at 14:31
0

From https://opensearch.org/docs/1.1/security-plugin/configuration/disable/

A more permanent option is to remove the security plugin entirely:

  • Delete the plugins/opensearch-security folder on all nodes.
  • Delete all plugins.security.* configuration entries from opensearch.yml.

Note: plugins.security.disabled: true is still needed in the opensearch.yml file.

0

I have experienced the similar issue and i have found that Opensearch was working but still it keep displaying "No alive nodes found in your cluster" After spending hours i was able to figure out that security issue Our local website was on http and running the cmd curl http://localhost:9200 returned curl: (52) Empty reply from server

On the other side curl https://localhost:9200 is returning the required result

Solution You need to configure the SSL locally to resolve this issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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