配置ElasticSearch Magento 2.4-在集群中找不到活动节点

问题描述

当尝试在magento 2.4中搜索产品时,返回以下错误

异常#0(Elasticsearch \ Common \ Exceptions \ NoNodesAvailableException):在群集中找不到活动节点

以下配置:

/etc/Nginx/conf.d/100-magento2.conf

upstream fastcgi_backend {
    server   unix:/run/PHP-fpm/www.sock;
}
server {
  listen 80;
  server_name _;

  set $MAGE_ROOT /var/www/magento2;
  include /var/www/magento2/Nginx.conf.sample;

}

/etc/Nginx/conf.d/90-es.conf

upstream   elasticsearch {
   server 127.0.0.1:9200;
}


server {
   server_name _;
   listen 8080;
   location / {
     limit_except HEAD {
        auth_basic "Restricted";
        auth_basic_user_file  /etc/Nginx/passwd/.esNginx;
     }
     proxy_pass http://127.0.0.1:9200;
     proxy_redirect off;
     proxy_set_header Host $host;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

  location /_aliases {
   auth_basic "Restricted";
   auth_basic_user_file  /etc/Nginx/passwd/.esNginx;
   proxy_pass http://127.0.0.1:9200;
   proxy_redirect off;
   proxy_set_header Host $host;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

  include /etc/Nginx/auth/*.conf;
}

如果尝试:bin / magento配置:显示目录/搜索/引擎

结果:elasticsearch7

如果尝试:curl -i localhost:9200 / _cluster / health?pretty

HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 461

{
  "cluster_name" : "magento2","status" : "yellow","timed_out" : false,"number_of_nodes" : 1,"number_of_data_nodes" : 1,"active_primary_shards" : 3,"active_shards" : 3,"relocating_shards" : 0,"initializing_shards" : 0,"unassigned_shards" : 3,"delayed_unassigned_shards" : 0,"number_of_pending_tasks" : 0,"number_of_in_flight_fetch" : 0,"task_max_waiting_in_queue_millis" : 0,"active_shards_percent_as_number" : 50.0
}

如果要在网络中尝试:
Configuration by web

elasticsearch.yml: elasticsearch.yml

解决方法

我遇到了完全相同的问题。对我来说,这是与 Smile-SA /elasticsuite 的兼容性问题。

解决方法是删除“vendor/smile”文件夹,然后执行 composer dump-autoload。 (我知道这不是永久修复,我现在拥有的)