When trying to search for a product in magento 2.4 returns the following error
Exception #0 (Elasticsearch\Common\Exceptions\NoNodesAvailableException): No alive nodes found in your cluster
Below configuration:
- PHP 7.4.1
- Nginx 1.14
- MySql 8
- ElasticSearch 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;
}
If try: bin/magento config:show catalog/search/engine
Result: elasticsearch7
If try: 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
}
And if try in web:
Configuration by web
elasticsearch.yml: elasticsearch.yml