The error “No alive nodes found in your cluster” means Magento cannot connect to its search engine, OpenSearch or Elasticsearch. In Magento 2.4 the search engine also powers category pages and layered navigation on most themes, so a lot more than the search box breaks.

What it looks like

  • Searches return an error or an empty page.
  • Category pages or filters fail to load.
  • The error appears in var/log/exception.log, or on screen in developer mode.

Step 1: is the search engine running?

sudo systemctl status opensearch    # or elasticsearch
curl localhost:9200

If it is stopped, start it:

sudo systemctl start opensearch

Search works again as soon as it accepts connections.

Step 2: why did it stop?

sudo journalctl -u opensearch --since "2 hours ago"
sudo dmesg | grep -i "out of memory"

The most common cause is the Linux kernel killing it for using too much memory. The Java heap was never sized, or was sized larger than the server can afford.

Step 3: size the Java heap

Set the minimum and maximum heap to the same value, roughly a quarter of the server’s RAM on a server shared with MySQL and PHP. Edit /etc/opensearch/jvm.options (or the Elasticsearch equivalent):

-Xms2g
-Xmx2g

Then restart the service.

Step 4: check Magento’s connection settings

If the engine runs but Magento still cannot reach it, check the host and port in Stores > Configuration > Catalog > Catalog > Catalog Search, and use Test Connection. After changing servers, also check app/etc/env.php if the settings are stored there.

Step 5: rebuild the index if needed

bin/magento indexer:reindex catalogsearch_fulltext

Catch it automatically

MageMonitor checks for this every few minutes as part of its Search checks, and alerts you by email, Slack or webhook the moment it appears, with the exact commands to fix it. See MageMonitor for Magento 2.

Related fixes