5

I'm trying to run ElasticSearch on Raspbian on my Raspberry Pi 3. After simply running sudo apt install elasticsearch it installed A LOT of things, and then I tried sudo service elasticsearch status, which gives the following result:

$ sudo service elasticsearch status
● elasticsearch.service - LSB: Starts elasticsearch
   Loaded: loaded (/etc/init.d/elasticsearch)
   Active: active (exited) since Thu 2017-02-16 23:28:52 UTC; 1s ago
  Process: 6022 ExecStop=/etc/init.d/elasticsearch stop (code=exited, status=0/SUCCESS)
  Process: 6063 ExecStart=/etc/init.d/elasticsearch start (code=exited, status=0/SUCCESS)

I don't really get what this active (exited) means. I tried getting the ElasticSearch version, but that also failed:

$ curl -XGET 'http://localhost:9200'
curl: (7) Failed to connect to localhost port 9200: Connection refused

Does anybody know what is wrong and how I can proceed from here?

4
  • What logs are saying? Feb 17, 2017 at 2:18
  • @VolodymyrBilyachat - There are no log files in /var/log/elasticsearch, the folder is empty. Any other ideas?
    – kramer65
    Feb 17, 2017 at 7:02
  • Do you have Java instaled? You could also try to install the elasticsearch manually/ through a binary/deb. Check this link: digitalocean.com/community/tutorials/…
    – JonyD
    Feb 17, 2017 at 9:36
  • Right after installing, you are directly checking the status, it is checking if it is able to start the server. Try to start the server using “sudo service elasticsearch start” and then do “curl”. May 30, 2019 at 11:29

2 Answers 2

10

In the end I managed to get it running. I had to install Java 8

sudo apt-get purge openjdk-7-jdk
sudo apt-get install openjdk-8-jdk

and set the memory maximum lower by opening /etc/elasticsearch/jvm.options and replacing

-Xms2G
-Xmx2G

with

-Xms256M
-Xmx256M

Restarting ES (sudo service elasticsearch start) solved it for me.

5
  • Did it really work with you? I still get cannot allocate enough memory error Jul 27, 2017 at 14:03
  • @MohammedNoureldin - Yes it did really work with me after doing this (although by now I don't use it anymore). Unfortunately I don't have any other tips than this. I hope you get it working as well!
    – kramer65
    Jul 27, 2017 at 18:43
  • 1
    Those changes in jvm.options works perfect for me! thank you very much! I was trying to change them from sysctl, not directly from jvm.options like you did, therefore they didn't work. Jul 28, 2017 at 0:46
  • 1
    @MohammedNoureldin There is no file named jvm.options. I am using latest raspbian stretch.
    – S Andrew
    Apr 18, 2018 at 6:47
  • @SAndrew, I cannot exactly remember, but it guess there should be such file in elasticsearch directory- Apr 18, 2018 at 10:59
0

At time of posting, installing through apt-get install elasticsearch on latest Raspbian release installs Elasticsearch 1.7 (which does not use /etc/elasticsearch/jvm.options)

Go to https://www.elastic.co/downloads/elasticsearch and get the link for the .deb package. Then install it with the following:

cd /home/pi
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.1.deb
dpkg -i elasticsearch-6.6.1.deb

Once you've done that you'll be able to edit /etc/elasticsearch/jvm.options and then start elasticsearch.

3

Your Answer

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

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