Error while running Magento Upgrade command

After Magento2.4 installation, trying to install the sample data. So performing the steps as instructed. Error is popping up while running the below upgrade command -
Command: php bin/magento setup:upgrade
Error: “Could not validate a connection to Elasticsearch. No alive nodes found in your cluster”
Note: The above command is executed under /var/www/html/ folder command prompt.

Please suggest the steps to resolve the issue.

FIX: Try rebooting the server and repeating the bin/magento setup:upgrade command.

I can confirm I get this same issue. This is my 6th clone of Magento 2.4 exactly per this guide (which is excellent, thanks Craig), this is the first time I’ve tried adding the sample data, and can confirm it gives the error reported as above.

At php bin/magento setup:upgrade …

shaunmarrison@ubuntu-pi:/mnt/HDD_160GB/ubuntu-pi/www/vanillawithdata$ php bin/magento setup:upgrade
Cache types config flushed successfully
Cache cleared successfully
File system cleanup:
The directory ‘/mnt/HDD_160GB/ubuntu-pi/www/vanillawithdata/generated/metadata/’ doesn’t exist - skipping cleanup
Updating modules:
Could not validate a connection to Elasticsearch. No alive nodes found in your cluster

I confirmed elasticsearch was broken by login in to the backend of another magento installation and clicking Stores > Configuration > Catalog > Catalog > Catalog Search > Test Connection - got and error message like “No Node Available”

I rebooted the server and repeated the command
php bin/magento setup:upgrade and the upgrade worked as normal

Thank you so much Shaun. This worked perfectly.
Just adding the commands here which has been followed -
sudo shutdown -r now
sudo service apache2 restart
php bin/magento setup:upgrade

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.