wardenenv / warden

Warden is a CLI utility for orchestrating Docker based developer environments
https://warden.dev
MIT License
402 stars 167 forks source link

could not validate a connection to Elasticsearch. No alive nodes found in your cluster #464

Closed hassanas closed 2 years ago

hassanas commented 2 years ago

I am using warden for magento 2.4 in shell when I run bin/magento s:up I am facing following error: could not validate a connection to Elasticsearch. No alive nodes found in your cluster following is mu .env file

`WARDEN_ENV_NAME=project-levo-m2 WARDEN_ENV_TYPE=magento2 WARDEN_WEB_ROOT=/ TRAEFIK_DOMAIN=project-levo-m2.test TRAEFIK_SUBDOMAIN=app

WARDEN_DB=1 WARDEN_ELASTICSEARCH=1 WARDEN_VARNISH=1 WARDEN_RABBITMQ=1 WARDEN_REDIS=1 ELASTICSEARCH_VERSION=7.9 MARIADB_VERSION=10.4 NODE_VERSION=10 COMPOSER_VERSION=1 PHP_VERSION=7.4 PHP_XDEBUG_3=1 RABBITMQ_VERSION=3.8 REDIS_VERSION=5.0 VARNISH_VERSION=6.0

WARDEN_SYNC_IGNORE=

WARDEN_ALLURE=0 WARDEN_SELENIUM=0 WARDEN_SELENIUM_DEBUG=0 WARDEN_BLACKFIRE=0 WARDEN_SPLIT_SALES=0 WARDEN_SPLIT_CHECKOUT=0 WARDEN_TEST_DB=0 WARDEN_MAGEPACK=0

BLACKFIRE_CLIENT_ID= BLACKFIRE_CLIENT_TOKEN= BLACKFIRE_SERVER_ID= BLACKFIRE_SERVER_TOKEN= `

sprankhub commented 2 years ago

Check the output of warden env logs -f elasticsearch. It may give you a hint what is wrong with your ES instance. Alternatively / additionally, run curl -X GET "elasticsearch:9200/_cluster/health?pretty" inside the Warden shell.

hardyjohnson commented 2 years ago

+1 to @sprankhub suggestion for verifying your local instance is healthy

You very likely need to re-run the Magento installation command to make sure the elastic search configuration is correct including the search engine name. The correct Magento module needs to be enabled and the core_config_data values need to be set.

Important install flags: --search-engine="elasticsearch7" --elasticsearch-host="elasticsearch" --elasticsearch-port="9200"

https://devdocs.magento.com/guides/v2.4/config-guide/elasticsearch/configure-magento.html https://github.com/magento/magento2/issues/29534

manuel-EGO commented 2 years ago

Hi,

I have the same issue, I am running a MBP with an M1X Chip, elastic search and redis does not work, for elastic search I got the same error than @hassanas , for redis: qemu: uncaught target signal 11 (Segmentation fault) - core dumped

In both cases, the error is fixed by using latests images from docker hub, on my local (for the time being), I have updated the image in: environments/includes/redis.base.yaml to redis:${REDIS_VERSION:-5.0} And for Elasticsearch, in file: environments/includes/elasticsearcg.base.yaml image: elasticsearch:${ELASTICSEARCH_VERSION:-7.0}

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

sszymkowicz commented 2 years ago

Still relevant for me. Didn't try @manuel-EGO solution yet.

manuel-EGO commented 2 years ago

Still relevant, I am still requiring the fix mentioned above.

davidalger commented 2 years ago

Multi-arch images for both Elasticsearch and Redis were built and pushed a couple days ago on #505, so crashing due to using emulated images should no longer be an issue. Please see #505 for cmds to pull the latest images, and recreate containers.

sszymkowicz commented 2 years ago

Trying to make official release working again but no luck.

Elasticsearch image used: docker.io/wardenenv/elasticsearch:7.6 Error on Magento Setup: ElasticSuite : Unable to validate connection to Elasticsearch server : No alive nodes found in your cluster curl -X GET 'https://elasticsearch:9200/' -> curl: (7) Failed to connect to localhost port 9200: Connection refused

ihor-sviziev commented 2 years ago

@sszymkowicz, Just tried version 7.6 - everythins works fine for me:

➜  magento2 git:(master) warden shell
www-data@magento2-php-fpm:/var/www/html$ uname -m
aarch64
www-data@magento2-php-fpm:/var/www/html$ curl -X GET 'http://elasticsearch:9200/'
{
  "name" : "magento2-elasticsearch",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "52GCzRdBRWucuCyDm8uWrA",
  "version" : {
    "number" : "7.6.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
    "build_date" : "2020-03-26T06:34:37.794943Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Try checking logs with warden env logs -f elasticsearch, maybe there is some issue

sszymkowicz commented 2 years ago

Thank you @ihor-sviziev for checking it on your env. I tried reinstalling warden using brew, then:

warden svc pull
warden svc up --force-recreate
warden env pull
warden env up --force-recreate

warden shell
www-data@php-fpm:/var/www/html$ uname -m
x86_64

Is there something else to do/update/upgrade that I'm not aware of?

ihor-sviziev commented 2 years ago

@sszymkowicz could you share your result of the following commands?

warden env ps -a
warden env logs elasticsearch
warden shell
curl -X GET 'http://elasticsearch:9200/'
sszymkowicz commented 2 years ago

@ihor-sviziev I already know what the issue was. Elasticsearch version I was using was 7.6, while minimal version built now is 7.10.

Elastic works like a charm after changing it's version to 7.10

TomekWie commented 2 years ago

In my case I was upgrading magento from 2.3.6 to 2.4.4. (PHP 8.1, Elasticsearch 7.16) My local environment was Warden on Ubuntu 20.04. To get rid of this error "Could not validate a connection to Elasticsearch. No alive nodes found in your cluster" (that was popping up during bin/magento setup:upgrade) I had to do two things: 1) manually add "elasticsearch" to node in vendor/magento/module-elasticsearch-7/etc/config.xml 2) disable elasticsearch6 and enable elasticsearch7 module

bin/magento module:enable {Magento_Elasticsearch,Magento_InventoryElasticsearch,Magento_Elasticsearch7}

bin/magento module:disable Magento_Elasticsearch6

Hope, that my answer will help someone :)

Otalvarosteven commented 2 years ago

In my case I was upgrading magento from 2.3.6 to 2.4.4. (PHP 8.1, Elasticsearch 7.16) My local environment was Warden on Ubuntu 20.04. To get rid of this error "Could not validate a connection to Elasticsearch. No alive nodes found in your cluster" (that was popping up during bin/magento setup:upgrade) I had to do two things:

  1. manually add "elasticsearch" to node in vendor/magento/module-elasticsearch-7/etc/config.xml
  2. disable elasticsearch6 and enable elasticsearch7 module

bin/magento module:enable {Magento_Elasticsearch,Magento_InventoryElasticsearch,Magento_Elasticsearch7}

bin/magento module:disable Magento_Elasticsearch6

Hope, that my answer will help someone :)

Thaks, @TomekWie your answer was helpful and a solution for me.

magneto0007 commented 1 year ago

This issue still persist on the latest version. Still not able to resolve. Any help ?

In .env I got ELASTICSEARCH_VERSION=7.6

Install fails with

In SearchConfig.php line 81:

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

Running curl -X GET 'http://elasticsearch:9200/' give below

curl: (6) Could not resolve host: elasticsearch

navarr commented 1 year ago

@magneto0007 Are you able to look in Docker Desktop at the log for ElasticSearch on your project? Receiving both of those errors, I would expect that ElasticSearch isn't starting or is quitting

RakeshJesadiya commented 1 year ago

For warden, https://www.rakeshjesadiya.com/magento-setup-upgrade-command-elasticsearch-no-alive-nodes-found-in-your-cluster/

diazwatson commented 1 year ago

It could be soo obvious but if for any reason you get this error after switch from opensearch to elasticsearch, make sure you update ALL your settings accordingly. 👇

Screenshot 2023-09-06 at 17 23 31

UsievaladHaponienka commented 2 months ago

If you setup warden project using warden env-init exampleproject magento2, you probably will have elasticsearch container. However, next part of Warden's documentation suggests installing Magento using opensearch. The solution for me was simply to replace all opensearch options with corresponding elasticsearch options. So, instead of:

     --search-engine=opensearch \
     --opensearch-host=opensearch \
     --opensearch-port=9200 \
     --opensearch-index-prefix=magento2 \
     --opensearch-enable-auth=0 \
     --opensearch-timeout=15 \

use this

     --search-engine=elasticsearch7 \
     --elasticsearch-host=elasticsearch \
     --elasticsearch-port=9200 \
     --elasticsearch-index-prefix=magento2 \
     --elasticsearch-timeout=15 \
     --elasticsearch-enable-auth=0 \

In you setup:install script.

Alternatively, I suppose, you can just copy example .env file and work with opensearch, this part in particular.

 WARDEN_ELASTICSEARCH=0
 WARDEN_OPENSEARCH=1