cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

SOLVED

Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

Hello,

 

I am installing Magento 2.4.3 Open source on my local Xampp server. However, the installation wont complete then I am receiving the following error message:

-------

"search engine 'elasticsearch8' is not an available search engine"

--------

I am running the following commands in CLI.

--------------------

php bin/magento setup:install --base-url=http://localhost/mage2rock --db-host=localhost --db-name=magento --db-user=root --db-password= --admin-firstname=admin --admin-lastname=admin --admin-email=admin@admin.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=Elasticsearch8 --elasticsearch-host="localhost" --elasticsearch-port=9200 --elasticsearch-enable-auth=true

-------------------

Anyone have any idea what could be the issue? Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

I am unsure of How are you installing Magento! @infoianmed1665 Let me know if we can connect somehow, and I can help you solve the installation issue. 

I am also a business practitioner and solution analyst; the steps I have shared are all given valid and follow the Magento process. But if still, you are getting errors, and there might be some reason for this. 

Let me know if you want me to assist you. Thank you.

Found the above suggestion helpful, hit the "Kudos" & Accept as Solution!

Thank you,
Rohan D.
Free & Premium Magento 2 Extensions

View solution in original post

12 REPLIES 12

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

Hi @infoianmed1665 , 

 

Magento 2.4.3 doesn't support elasticsearch8! So, you need to install elasticsearch7.X or 6.X in your local. 

Here are a few possibilities you need to check to troubleshoot: 

 

  1. Verify Elasticsearch Installation: As my first guess goes, Magento 2.4.3 does not support Elasticsearch8. Ensure that you have installed Elasticsearch version 7.x or 6.x on your local XAMPP server. 

  2. Confirm Elasticsearch Service Status: Check if the Elasticsearch service is running properly on your local XAMPP server. You can verify this by accessing the Elasticsearch URL in your web browser (e.g., http://localhost:9200). If Elasticsearch is running, you should see a JSON response with version information.

  3. Adjust the Elasticsearch Engine Setting: In your installation command, replace "Elasticsearch8" with "Elasticsearch6" or "Elasticsearch7," depending on the version you have installed. The search engine parameter should match the Elasticsearch version you are using.

  4. Verify Elasticsearch Connection Details: Double-check the Elasticsearch host and port values in your installation command. Ensure they match the configuration of your local Elasticsearch installation. By default, Elasticsearch runs on localhost (127.0.0.1) and port 9200.

After making these adjustments, try running the installation command again and see if the error persists. 

If the issue persists, please provide any relevant error logs or additional information that could help further diagnose the problem. Or you should be fine with this solution. 

Found the above suggestion helpful, hit the "Kudos" & Accept as Solution!

Thank you,
Rohan D.
Free & Premium Magento 2 Extensions

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

Hello @infoianmed1665 


You have to install elasticsearch7 not elasticsearch8.


Then run below command

bin/magento setup:install --base-url=http://localhost/mage2rock --db-host=localhost --db-name=magento --db-user=root --db-password= --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com --admin-user=admin --admin-password=admin123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=localhost --elasticsearch-port=9200


Thanks

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

Thank you for your reply. I have completed the steps described in your reply. I have now installed ElasticSearch7.16.2. The ElasticSearch error seems to be gone for now. However, the installation has errors. I am getting the errors below.

---

In Mysql.php line 109:

SQLSTATE[42S02]: Base table or view not found: 1932 Table 'magento.flag' doesn't exist in engine, query was: DESCRIBE `flag`


In Mysql.php line 90:

SQLSTATE[42S02]: Base table or view not found: 1932 Table 'magento.flag' doesn't exist in engine

---

I am stuck for now. Any ideas/solutions will be much appreciated.

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

It shows the "flag" table is missing in the CLI command. Check the database and verify if the "flag" table is missing. 

Then run the database upgrade command in your installation dir, clear the cache, and again install Magento. 

You should be fine with it. 

Found the above suggestion helpful, hit the "Kudos" & Accept as Solution!

Thank you,
Rohan D.
Free & Premium Magento 2 Extensions

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

Thank you for your suggestion and solution proposal. I have checked in phpMyadmin and indeed I can see that the table "flag" does exist but when you click on it you get the following error message:

"#1932 -Table 'magento.flag' doesn't exist in engine".

 

To be honest, I am not sure how to go about upgrading the database. Could you please provide explicit commands that I need to run to upgrade the mySQL database, clear cache in Xampp?

Sorry for bothering. If you this is not clear and need further info, please let me know.

 

Thank you in advance for your response.

 

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

o explicitly upgrade the Magento database and clear the cache in XAMPP, please follow these steps:

  1. Upgrade the Database:

    • Open a command prompt or terminal.

    • Navigate to your Magento installation directory.

    • Run the following command:

      php bin/magento setup:upgrade

    This command triggers the database upgrade process in Magento and ensures that all necessary tables, including the flag table is created or updated.

  2. Clear the Cache:

    • In the command prompt or terminal, while still in the Magento installation directory, run the following command:

      php bin/magento cache:clean

    This command clears the cache in Magento, ensuring caching.

Found the above suggestion helpful, hit the "Kudos" & Accept as Solution!

Thank you,
Rohan D.
Free & Premium Magento 2 Extensions

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

Thank you again for your response. I have tried your upgrade commands but those won't solve my problem.

 

So I decided to drop all the tables in the Magento MySQL database so that I can install from scratch. When I try to install am getting this error message below even though the database is empty.

---

In Mysql.php line 109:

SQLSTATE[HY000]: General error: 1813 Tablespace for table '`magento`.`setup_module`' exists. Please DISCARD the tablespace befor
e IMPORT, query was: CREATE TABLE IF NOT EXISTS `setup_module` (
`module` varchar(50) NOT NULL COMMENT 'Module' ,
`schema_version` varchar(50) NULL COMMENT 'Schema Version' ,
`data_version` varchar(50) NULL COMMENT 'Data Version' ,
PRIMARY KEY (`module`)
) COMMENT='Module versions registry' ENGINE=innodb charset=utf8 COLLATE=utf8_general_ci


In Mysql.php line 90:

SQLSTATE[HY000]: General error: 1813 Tablespace for table '`magento`.`setup_module`' exists. Please DISCARD the tablespace befor
e IMPORT

---

 

My background is in business and technical and need to prepare for a Magento project which will start in 10 days time so I hope you understand. I don't want to give up but the Magento installation issue is surely testing my patience. Anybody else have ideas on how to fix my issue?

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

I can understand your situation. Here's the solution that my dev team is following:

Please delete the app/etc/env.php file.

 

Then run the below command

 

php bin/magento setup:install --base-url="http://localhost/mag24/" --db-host="localhost" --db-name="mag24" --db-user="root" -db-password="root123" --admin-firstname="admin" --admin-lastname="admin" --admin-email="admin@admin.com" --admin-user="admin" --admin-password="admin123" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin"

Please change the database credentials and URL in the given command as per yours. 

Found the above suggestion helpful, hit the "Kudos" & Accept as Solution!

Thank you,
Rohan D.
Free & Premium Magento 2 Extensions

Re: Unable to complete Magento CE 2.4.3 installation in CLI due to Elasticsearch8 error

Thanks again for your suggestion. I couldn't find such a file env.php in Xampp.

 

Now when I run the Magento installation command you provided, I am getting this error message. The installation runs for several minutes before it stops due to this error.

---

In SearchConfig.php line 81:

Could not validate a connection to Elasticsearch. No alive nodes found in your cluster

----

But when I run the code "curl -X GET 'http://localhost:9200' check on the installation of Elasticsearch in CLI, I am getting this error.

---

At line:1 char:2
+ - curl -X GET 'http://localhost:9200'
+ ~
Missing expression after unary operator '-'.
At line:1 char:3
+ - curl -X GET 'http://localhost:9200'
+ ~~~~
Unexpected token 'curl' in expression or statement.
+ CategoryInfo : ParserError: (Smiley Happy [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingExpressionAfterOperator

----

I hope someone can spot the mistake and suggest a solution. Thanks a million times.