【问题标题】:Config ElasticSearch Magento 2.4 - No alive nodes found in your cluster配置 ElasticSearch Magento 2.4 - 在您的集群中找不到活动节点
【发布时间】:2021-01-04 16:09:03
【问题描述】:

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

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

以下配置:

  • PHP 7.4.1
  • Nginx 1.14
  • MySql 8
  • 弹性搜索 7.9

/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 config:show catalog/search/engine

结果: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

【问题讨论】:

  • 问题是selinux,已解决

标签: elasticsearch nginx magento2 nginx-config proxypass


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-14
    • 1970-01-01
    • 2018-01-17
    • 2021-03-23
    • 2022-11-10
    • 2015-12-11
    相关资源
    最近更新 更多