2

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

4
  • 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
    Commented Mar 1, 2019 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
    Commented Mar 3, 2019 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
    Commented Mar 4, 2019 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
    Commented Mar 4, 2019 at 3:55

2 Answers 2

0

I also thinking for the same So my thoughts are "If your Magento website and Elastic Search are both in the same server then you don't have to change anything in /etc/elasticsearch/elasticsearch.yml just confirm that it must be localhost "network.host: localhost"
And port 9200 must not be allowed to the world via firewall you can confirm that via browsing http://server-ip:9200 if the port is allowed then you will get JSON output.
If the elastic search is on a different server then it also must not allow port 9200 to outside the same as above. So in this case, if you want to be work elastic search on your website you can configure apache2 or nginx proxy."
Please correct me If I'm wrong.

0

Download elasticsearch from this URL https://www.elastic.co/downloads/elasticsearch

Then unzip it in windows localhost htdocs folder please rename the folder to elasticsearch

After that open

htdocs\elasticsearch\bin

and in that find elasticsearch.bat file Right-click on that file and click Run as administrator.

Now the command window will open and elasticsearch is now working Don't close it while you are using all your command you mentioned in other command prompts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.