Consent to the use of Personal Data and Cookies

This website needs your consent to use cookies in order to customize ads and content.

If you give us your consent, data may be shared with Google.

Elasticsearch: No alive nodes found in your cluster

Typical causes and solutions for the No alive nodes found in your cluster error with Elasticsearch.

2 views
d

By. Jacob

Edited: 2022-07-29 15:09

The No alive nodes found in your cluster error typically indicates that Elasticsearch is unavailable. This can happen for a number of reasons, the specific reason may be hinted in the status or Elasticsearch log files.

The status can be checked with systemctl:

systemctl status elasticsearch

Running this command might give the following output:

Jul 27 08:42:24 lima-shopware systemd[1]: Starting Elasticsearch...
Jul 27 08:42:31 lima-shopware systemd[1]: Started Elasticsearch.
Jul 27 10:32:39 lima-shopware systemd[1]: elasticsearch.service: A process of this unit has been killed by the OOM killer.
Jul 27 10:32:39 lima-shopware systemd-entrypoint[2610]: ERROR: Elasticsearch exited unexpectedly
Jul 27 10:32:39 lima-shopware systemd[1]: elasticsearch.service: Failed with result 'oom-kill'.
Jul 27 10:32:39 lima-shopware systemd[1]: elasticsearch.service: Consumed 1min 1.125s CPU time.

As you can deduce from this, in my case the cause for No alive nodes found in your cluster is that Elasticsearch was killed due to running out of memory. The solution is to either increase the available memory in the system itself or decrease the java heap size.

If you are just running in a test environment, such as in a VM, docker container, or even a small cloud instance, you may be able to run Elasticsearch with less ram than you would in a live environment. In this case, you can try to decrease the java heap size as much as possible. E.g. Edit /etc/elasticsearch/jvm.options.d/custom.options and start with 1 GB:

-Xms1g
-Xmx1g

But if possible, also try experimenting with making more memory available in your instance. It is typically recommended to run Elasticsearch in a separate instance, so it does not compete with other services for memory – but in my opinion this really should not be necessary, especially not in development-setups.

When trying to access your website you may get 500 Internal Server error if running in prod mode, or more specifically, if you are testing your site in dev mode, the actual cause for the error might show as: No alive nodes found in your cluster.

If you read the message closely, then you can tell that Elasticsearch was unexpectedly terminated by the Linux OOM killer, which indicates that the system itself may be running low on memory.

In my own case, I got this error on a Shopware website that I am working on in a local dev environment. If you are also on Shopware, you can change to dev mode in your .env file of your website root, as this may show the actual error in your browser rather than just the typical 500 internal server error message.

Tell us what you think:

  1. How you may be able to safely downgrade your Shopware installation in case you accidentally updated.
  2. How to disable certain Exception error messages in Shopware, so that redundant messages do not show up in the log file.
  3. How to debug a problem in Shopware where getLabel() returns null instead of string.
  4. Things that might go wrong with Scheduled Tasks in Shopware.

More in: Shopware