1

I have many problems when installing Elasticsearch on my server. I'm going to put the steps that I followed in case someone can tell me if I'm missing something or not, please, or if I need to install something.

My system Ubuntu 18.04, Nginx 1.14.0, MySQL 5.7.25, Magento 2.3, PHP 7.1.26, Magento 2.3

I followed this link:

Install and configure Elasticsearch (devdocs.magento.com)

I have installed the Java Software Development Kit (JDK) with this steps:

sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get -y update
sudo apt-get install -y oracle-java8-installer

I have installed Elasticsearch 6.6 follow this steps:

sudo wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.deb
sudo wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.deb.sha512
sudo shasum -a 512 -c elasticsearch-6.6.0.deb.sha512 
sudo dpkg -i elasticsearch-6.6.0.deb
sudo rm elasticsearch-6.6.0.deb
sudo rm elasticsearch-6.6.0.deb.sha512
sudo vi /etc/elasticsearch/elasticsearch.yml
    network.host: localhost
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch
curl -XGET "localhost:9200" ------> (everything works correctly)

Configure and run cron: With this step is enough? or should I create a specific cron job for reindexing?

php bin/magento cron:install

and then, to configure my nginx I followed this link:

Configure nginx and Elasticsearch (devdocs.magento.com)

Set up a proxy. Is this step necessary?

To create a new file /etc/nginx/conf.d/magento_es_auth.conf with the following contents

server {
    listen 8080;
    location / {
        proxy_pass http://localhost:9200;
    }
}

Next steps

service nginx restart
curl -i http://localhost:8080/_cluster/health ------> (everything works correctly)

I have configured Magento to use Elasticsearch. And it seems that everything works correctly.

Secure communication with nginx. Is this step necessary?

Can someone help me resolve my questions in bold? And to know if these are the passos necessary to install and configure Elasticsearch or if I need to do something else

  • The point of setting up the secure proxy is to password protect access to elasticsearch, otherwise other people can use it! For example i use NGinx and have basic authentication setup. I have blocked the ports to my elasticsearch on the firewall so that they have to be passed internally on the server by NGinx – Anthony Mar 1 at 1:17
  • Hi! So, if I have well configured nginx with good security, can I save the proxy step, right? Could you tell me how you have your configured? what steps? – Despotars Mar 3 at 12:31
  • What port are you running elastic search on? How do you access the elastic search port? You use the auth_basic in Nginx to use a password. See here blog.eagerelk.com/securing-elasticsearch-using-nginx-as-a-proxy – Anthony Mar 4 at 3:51
  • My setup - Every port blocked by the firewall except 80 and 443 on Server 2 (my Elastic server). Magento (Server 1) -> Port 443 Nginx/Elastic (Server 2) -> auth_basic Logon -> Proxy 9200 -> Elastic lookup -> Nginx (443) - Magento – Anthony Mar 4 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.