docker-magento icon indicating copy to clipboard operation
docker-magento copied to clipboard

Existing project : Update to Magento 2.4.6 via composer

Open emetik opened this issue 2 years ago • 1 comments

Description

After updating my composer.json file to use the new version of Magento 2.4.6 from a 2.4.5-p1, the setup:upgrade fails

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

I've used the bin/update to make sure the files are up to date but it didn't change the result.

My opensearch is reachable by http :

{
name: "24b9dd268e1b",
cluster_name: "docker-cluster",
cluster_uuid: "E7sJs-dBQoOcsmknQWmTHw",
version: {
distribution: "opensearch",
number: "1.2.4",
build_type: "tar",
build_hash: "e505b10357c03ae8d26d675172402f2f2144ef0f",
build_date: "2022-01-14T03:38:06.881862Z",
build_snapshot: false,
lucene_version: "8.10.1",
minimum_wire_compatibility_version: "6.8.0",
minimum_index_compatibility_version: "6.0.0-beta1"
},
tagline: "The OpenSearch Project: https://opensearch.org/"
}

My database config contains the following records :

  • catalog/search/elasticsearch7_server_hostname opensearch
  • catalog/search/elasticsearch7_server_port 9200

Expected result

Install to complete

Thanks for your help !

emetik avatar Mar 21 '23 09:03 emetik

In 2.4.6 the default engine is OpenSearch but your config catalog/search/elasticsearch7_server_hostname is set for ElasticSearch 7.

You have two options: change search engine to elasticsearch7 or copy the config for OpenSearch engine.

For example:

bin/magento config:set catalog/search/opensearch_server_hostname opensearch
bin/magento config:set catalog/search/opensearch_server_port 9200

I haven't tested it, but I'm basing it on previous working config for ES.

MTheProgrammer avatar Mar 22 '23 04:03 MTheProgrammer

I had a similar issue with existing project (v 2.4.6) which I decided to setup with OpenSearch engine (previously I used ES).

My env.php catalog search settings:

'engine' => 'opensearch',
'opensearch_server_hostname' => 'opensearch',
'opensearch_server_port' => '9200'

OpenSearch service is up and running:

$ curl localhost:9200 
{
  "name" : "c9ac629ad72d",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "iyBOAniXRd-N_ovmYCUtZQ",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.5.0",
    "build_type" : "tar",
    "build_hash" : "b8a8b6c4d7fc7a7e32eb2cb68ecad8057a4636ad",
    "build_date" : "2023-01-18T23:49:00.584806002Z",
    "build_snapshot" : false,
    "lucene_version" : "9.4.2",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

But Magento still refusing to properly finish index process:

$ bin/magento indexer:reindex
Design Config Grid index has been rebuilt successfully in 00:00:00
Customer Grid index has been rebuilt successfully in 00:00:00
Category Products index has been rebuilt successfully in 00:00:00
Product Categories index has been rebuilt successfully in 00:00:00
Catalog Rule Product index has been rebuilt successfully in 00:00:00
Product EAV index has been rebuilt successfully in 00:00:00
Stock index has been rebuilt successfully in 00:00:00
Inventory index process error during indexation process:
Could not ping search engine: No alive nodes. All the 1 nodes seem to be down. # this line
Catalog Product Rule index has been rebuilt successfully in 00:00:00
Product Price index has been rebuilt successfully in 00:00:00
Catalog Search index process error during indexation process:
Could not ping search engine: No alive nodes. All the 1 nodes seem to be down. # this line

I also noticed this line in log files:

[...] main.ERROR: opensearch search engine doesn't exist. Falling back to elasticsearch8 [] []

I fixed this by enabling the Magento_OpenSearch module.

To check if Magento_OpenSearch module is enabled:

$ bin/magento module:status Magento_OpenSearch

To enable the Magento_OpenSearch module:

$ bin/magento module:enable Magento_OpenSearch
$ bin/magento setup:upgrade

After enabling the Magento_OpenSearch module I can confirm that Magento is synced with OpenSearch properly, maybe my case will save someone time spent on debugging.

rybkinevg avatar Mar 26 '24 16:03 rybkinevg

I'll close this as it appears to be resolvable. Please let me know if it is not.

markshust avatar Apr 03 '24 19:04 markshust