I recently tried to install and run a URL rewrite extension and got Errors regarding ElasticSearch. I've just tried to run the upgrade command after uploading the Magento Porto theme files:
PHP bin/Magento setup:upgrade
It runs and then gives the following Error at the end:
Could not validate a connection to Elasticsearch. No alive nodes found in your cluster
We currently have the following hosting package:
4 x 2.50GHz Cores 8 GB RAM 160 GB SSD Space 5 TB Bandwidth
My hosting company blames the problem on not enough RAM, therefore ElasticSearch crashing:
The ElasticSearch was down. Which was caused due to lack of memory as per the following Out of Memory errors: Aug 9 17:33:16 node1340 kernel: Out of memory: Killed process 28699 (java) total-vm:4963036kB, anon-rss:1411888kB, file-rss:0kB, shmem-rss:0kB, UID:987 pgtables:3516kB oom_score_adj:0 Aug 9 20:05:50 node1340 kernel: Out of memory: Killed process 15161 (java) total-vm:4945536kB, anon-rss:1370884kB, file-rss:0kB, shmem-rss:0kB, UID:987 pgtables:3336kB oom_score_adj:0 After flushing the cached swap and physical memory, I was able to start your ElasticSearch service.
Your current memory usage is: total used free shared buff/cache available Mem: 7937 4771 1288 470 1877 764 Swap: 511 0 511
Thus you indeed might consider upgrading to a service with more physical memory available to avoid these issues and the service running out of memory.
I checked RAM requirements for Magento 2.4.2-p1 and if I'm looking at this correctly - it says 2 GB of RAM should be fine? (we have 8 GB):
So the big question is - is the hosting company lying to me to get more money out of me or do I really need to upgrade my hosting package and pay lots more each month? If it is not necessary, how can I make sure ElasticSearch stays up and running?
Also, can I just re-run the Magento Porto theme upgrade command once ElasticSearch is running?
php bin/magento setup:upgrade