cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4.4 Install CLI AWS OpenSearch

SOLVED

Magento 2.4.4 Install CLI AWS OpenSearch

I am trying to install Magento 2.4.4 using Magento CLI. I have php 8.1 installed on Amazon Linux 2.
I created AWS Opensearch and it's up and running. I can even connect via curl:
[myuser@myip html]$ curl -u 'MYUSER:MYPASSWORD' -XGET https://es-host.MYDOMAIN.com/_cluster/health
{"cluster_name":"123456789101:MY-OPENSEARCH","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"discovered_master":true,"active_primary_shards":3,"active_shards":3,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"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":100.0}
I get a green status, 1 node and all 3 shards are running.
But when I try to install Magento I get the following error:
Module 'Temando_ShippingRemover':
[Progress: 656 / 1319]
[Progress: 657 / 1319]
Installing search configuration...

In SearchConfig.php line 81:

  [Magento\Framework\Validation\ValidationException]
  Could not validate a connection to Elasticsearch. No alive nodes found in your cluster


Exception trace:
  at /var/www/html/setup/src/Magento/Setup/Model/SearchConfig.php:81
 Magento\Setup\Model\SearchConfig->validateSearchEngine() at /var/www/html/setup/src/Magento/Setup/Model/SearchConfig.php:69
 Magento\Setup\Model\SearchConfig->saveConfiguration() at /var/www/html/setup/src/Magento/Setup/Model/Installer.php:1197
 Magento\Setup\Model\Installer->installSearchConfiguration() at n/a:n/a
 call_user_func_array() at /var/www/html/setup/src/Magento/Setup/Model/Installer.php:385
 Magento\Setup\Model\Installer->install() at /var/www/html/setup/src/Magento/Setup/Console/Command/InstallCommand.php:238
 Magento\Setup\Console\Command\InstallCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1009
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/magento/framework/Console/Cli.php:115
 Magento\Framework\Console\Cli->doRun() at /var/www/html/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /var/www/html/bin/magento:23
And this is the install command:
magento setup:install -vvv \
--base-url="https://MYSTORE.mydomain.com/" \
--db-host="MYSTORE.rds.amazonaws.com" \
--db-name=magento \
--db-user=MYSTOREdb \
--db-password=Thissom3StrongPassword \
--backend-frontname=securelocation \
--admin-firstname=Name \
--admin-lastname=Last \
--admin-email="MYEMAIL@gmail.com" \
--admin-user=USER \
--admin-password=Thissom3StrongPassword \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--use-secure=0 \
--use-secure-admin=0 \
--session-save=db \
--search-engine=elasticsearch7 \
--elasticsearch-host=https://es-host.MYDOMAIN.com \
--elasticsearch-port=9200 \
--elasticsearch-enable-auth=true \
--elasticsearch-username=USERNAME \
--elasticsearch-password=PASSWORD \
--use-rewrites=1 \
--use-secure=1 \
--use-secure-admin=1
Magento documentation is quite useless. Does anyone have some tutorial or documentation (other than Magento) that explains?
Thanks!
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento 2.4.4 Install CLI AWS OpenSearch

Two years ago I replied someone having similar issues with AWS ElasticSearch: https://magento.stackexchange.com/questions/318699/magento-2-4-with-aws-es-not-able-to-install/31886...

 

It seems like Magento still can't connect to OpenSearch or ElasticSearch on AWS if master user is being used for authentication.

I decided to leave OpenSearch without authentication and locked down access with Security Group and allow only VPC access (no public access).

 

I don't need to access the dashboard, so I didn't use AWS Cognito for that, but it's an option.

View solution in original post

3 REPLIES 3

Re: Magento 2.4.4 Install CLI AWS OpenSearch


@WestPennPower wrote:
I am trying to install Magento 2.4.4 using Magento CLI. I have php 8.1 installed on Amazon Linux 2.
I created AWS Opensearch and it's up and running. I can even connect via curl:
[myuser@myip html]$ curl -u 'MYUSER:MYPASSWORD' -XGET https://es-host.MYDOMAIN.com/_cluster/health
{"cluster_name":"123456789101:MY-OPENSEARCH","status":"green","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"discovered_master":true,"active_primary_shards":3,"active_shards":3,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0,"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":100.0}
I get a green status, 1 node and all 3 shards are running.
But when I try to install Magento I get the following error:
Module 'Temando_ShippingRemover':
[Progress: 656 / 1319]
[Progress: 657 / 1319]
Installing search configuration...

In SearchConfig.php line 81:

  [Magento\Framework\Validation\ValidationException]
  Could not validate a connection to Elasticsearch. No alive nodes found in your cluster


Exception trace:
  at /var/www/html/setup/src/Magento/Setup/Model/SearchConfig.php:81
 Magento\Setup\Model\SearchConfig->validateSearchEngine() at /var/www/html/setup/src/Magento/Setup/Model/SearchConfig.php:69
 Magento\Setup\Model\SearchConfig->saveConfiguration() at /var/www/html/setup/src/Magento/Setup/Model/Installer.php:1197
 Magento\Setup\Model\Installer->installSearchConfiguration() at n/a:n/a
 call_user_func_array() at /var/www/html/setup/src/Magento/Setup/Model/Installer.php:385
 Magento\Setup\Model\Installer->install() at /var/www/html/setup/src/Magento/Setup/Console/Command/InstallCommand.php:238
 Magento\Setup\Console\Command\InstallCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1009
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/magento/framework/Console/Cli.php:115
 Magento\Framework\Console\Cli->doRun() at /var/www/html/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /var/www/html/bin/magento:23
And this is the install command:
magento setup:install -vvv \
--base-url="https://MYSTORE.mydomain.com/" \
--db-host="MYSTORE.rds.amazonaws.com" \
--db-name=magento \
--db-user=MYSTOREdb \
--db-password=Thissom3StrongPassword \
--backend-frontname=securelocation \
--admin-firstname=Name \
--admin-lastname=Last \
--admin-email="MYEMAIL@gmail.com" \
--admin-user=USER \
--admin-password=Thissom3StrongPassword \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--use-secure=0 \
--use-secure-admin=0 \
--session-save=db \
--search-engine=elasticsearch7 \
--elasticsearch-host=https://es-host.MYDOMAIN.com \
--elasticsearch-port=9200 \
--elasticsearch-enable-auth=true \
--elasticsearch-username=USERNAME \
--elasticsearch-password=PASSWORD \
--use-rewrites=1 \
--use-secure=1 \
--use-secure-admin=1
Magento documentation is quite useless. Does anyone have some tutorial or documentation (other than Magento) that explains?
Thanks!

You must first establish an OpenSearch instance in AWS. Read Creating and managing Amazon OpenSearch Service domains for detailed instructions.

Re: Magento 2.4.4 Install CLI AWS OpenSearch

@ramyarjaha31f0 

If you read my post, I said:

I created AWS Opensearch and it's up and running. I can even connect via curl:

Please read the whole post before posting an answer.

Re: Magento 2.4.4 Install CLI AWS OpenSearch

Two years ago I replied someone having similar issues with AWS ElasticSearch: https://magento.stackexchange.com/questions/318699/magento-2-4-with-aws-es-not-able-to-install/31886...

 

It seems like Magento still can't connect to OpenSearch or ElasticSearch on AWS if master user is being used for authentication.

I decided to leave OpenSearch without authentication and locked down access with Security Group and allow only VPC access (no public access).

 

I don't need to access the dashboard, so I didn't use AWS Cognito for that, but it's an option.