I am running ElasticSearch6 in my docker files.
if i run http://localhost:9200/ in my browser i get this information.
{
"name" : "shakedeal-1",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "X4OkctATTgmlcdLzmtJ4Yg",
"version" : {
"number" : "6.5.4",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "d2ef93d",
"build_date" : "2018-12-17T21:17:40.758843Z",
"build_snapshot" : false,
"lucene_version" : "7.5.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
Here are the contents of my docker/elasticSearch/config/elasticSearch.yml file.
---
## Default Elasticsearch configuration from elasticsearch-docker.
## from https://github.com/elastic/elasticsearch-docker/blob/master/build/elasticsearch/elasticsearch.yml
#
cluster.name: "docker-cluster"
node.name: "shakedeal-1"
network.host: 0.0.0.0
# minimum_master_nodes need to be explicitly set when bound on a public IP
# set to 1 to allow single node clusters
# Details: https://github.com/elastic/elasticsearch/pull/17288
discovery.zen.minimum_master_nodes: 1
## Use single node discovery in order to disable production mode and avoid bootstrap checks
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
#
discovery.type: single-node
Now if i install my magento2 using CLI command.
php bin/magento setup:install --base-url='http://tile500.co.pk/' \
--db-host='mysql' --db-name='Tile500New' --db-user='root' --db-password='tiger' \
--admin-firstname='Magento' --admin-lastname='User' --admin-email='sanaullahAhmad@gmail.com' \
--admin-user='admin' --admin-password='admin123' --language='en_US' \
--currency='USD' --timezone='America/Chicago' --use-rewrites=1 \
--search-engine='elasticsearch6' --elasticsearch-host='localhost' \
--elasticsearch-port='9200'
I get this error
[Progress: 601 / 1206]
Installing search configuration...
In SearchConfig.php line 81:
Could not validate a connection to Elasticsearch. No alive nodes found in your cluster
Best Answer
I encountered this problem which is really tiring when installing a new
Magento 2.4
.In SearchConfig.php line 81: Could not validate a connection to Elasticsearch. No alive nodes found in your cluster
This error means that either you don't have
Elasticsearch
installed in your system or thehost
configuration which is not correct.check if
Elasticsearch
is installed :with example :
if you find that Elasticsearch is installed, you go directly to step 4, otherwise you go to step 3 then 4
Elasticsearch
installation : Reference3.1 We must have OpenJDK to make work Elasticsearch
3.2 import the Elasticsearch public GPG key
3.3 add the Elasticsearch source to the
sources.list.d
directory, where apt will search for new sources3.4 update the packages to read the Elastic source
3.5 install Elasticsearch
3.6 we configure Elasticsearch host
uncomment and replace
#network.host: 192.168.0.1
withnetwork.host: localhost
3.7 We start Elasticsearch
3.8 We check the status
3.9 Working Elastic
Magento command installation
In step
3.6
, we set the HOST value with : localhost (network.host: localhost
) so we will set the same thing for--elasticsearch-host='localhost'
and--elasticsearch-port=9200
, we have keep the default port 9200 (#http.port: 9200
).So an example for the Magento CLI installation :
Enjoy !