Cristian Ciobotea
Cristian Ciobotea

Reputation: 457

Installing elasticsearch 7 on raspberry pi 3

I am trying to install the latest Elasticsearch on my Raspberry Pi 3 by following the installation tutorial, however I found absolutely

Some info about my system:

$ sudo apt-get update
$ sudo apt-get upgrade

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian

$ java -version
openjdk version "9-Raspbian"
OpenJDK Runtime Environment (build 9-Raspbian+0-9b181-4bpo9rpt1)
OpenJDK Server VM (build 9-Raspbian+0-9b181-4bpo9rpt1, mixed mode)

// I tried also with openjdk-java-8

What I've tried

  1. install via sudo-apt
$ sudo apt-get install elasticsearch
....
Preparing to unpack .../elasticsearch_1.7.5-1_all.deb .
....

$ ./usr/share/elasticsearch/bin/elasticsearch

xception in thread "main" java.lang.NoClassDefFoundError: org/elasticsearch/common/jackson/dataformat/yaml/snakeyaml/error/YAMLException
    at org.elasticsearch.common.jackson.dataformat.yaml.YAMLFactory._createParser(YAMLFactory.java:426)
    at org.elasticsearch.common.jackson.dataformat.yaml.YAMLFactory.createParser(YAMLFactory.java:327)
    at org.elasticsearch.common.xcontent.yaml.YamlXContent.createParser(YamlXContent.java:90)
    at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:45)
    at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:46)
    at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:982)
    at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromUrl(ImmutableSettings.java:969)
    at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:110)
    at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:144)
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:215)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)
Caused by: java.lang.ClassNotFoundException: org.elasticsearch.common.jackson.dataformat.yaml.snakeyaml.error.YAMLException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 11 more

  1. got to elasticsearch downloads and get the tar-file
/elasticsearch-7.1.1/bin/elasticsearch

./elasticsearch-7.1.1/bin/elasticsearch-env: line 69: /home/pi/elasticsearch-7.1.1/jdk/bin/java: cannot execute binary file: Exec format error
  1. docker path
$ docker --version
Docker version 18.04.0-ce, build 3d479c0

$ docker image ls
REPOSITORY                                      TAG                 IMAGE ID            CREATED             SIZE
docker.elastic.co/elasticsearch/elasticsearch   7.1.1               b0e9f9f047e6        4 weeks ago         894MB

$ docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.1.1
standard_init_linux.go:190: exec user process caused "exec format error"

Has anyone managed to install Elasticsearch 7 on Raspberry Pi 3? Is there any way to go around the issues listed above?

Upvotes: 2

Views: 4363

Answers (6)

Idriss Neumann
Idriss Neumann

Reputation: 3838

In order to be able to use easily Elasticsearch, Kibana and Elastalert on raspberrypi we made available on dockerhub, those 3 docker images:

Here's the git repository containing the Dockerfiles and documentations: https://gitlab.comwork.io/oss/elasticstack/elasticstack-arm (the docker images are built on raspberrypi using as gitlab runners then pushed on the dockerhub).

We'll keep them up to date with the right tags until elastic will take care of it (I think they will provide arm-based images some days, after discussing this matter with them).

Here's an example of docker-compose file you can use on a single raspberrypi:

version: "3.3"

services:
  es01:
    image: comworkio/elasticsearch:7.9.1-1.8-arm
    container_name: es01
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - covid19
    volumes:
      - data01:/usr/share/elasticsearch/data
  kib01:
    image: comworkio/kibana:7.9.1-1.9-arm
    container_name: kib01
    ports:
      - 5601:5601
    environment:
      - ES_PROTO=http
      - ES_HOST=es01
      - ES_PORT=9200
    networks:
      - covid19
    depends_on: 
      - es01

volumes:
  data01:
    driver: local

networks:
  covid19:
    driver: bridge

Then here you go with:

docker-compose up -d

Then your kibana is accessible on http://{your_raspberrypi}:5601 and your elasticsearch api on http://{your_raspberrypi}:9200. This is working pretty fine with a raspberrypi 4 model B 8gb ram. If you don't have this model but an older one, you can use two of them with at least 2gb for your elastic node and 2gb for your kibana node. I also advise you tu use a model 4 in order to be able to boot on a SSD drive instead of an SD flash.

For the french speakers, here's a demo using those images: https://youtu.be/BC1iSnoe15k

And the repository of the project with some documentations (in english): https://gitlab.comwork.io/oss/covid19

Upvotes: 0

Rushab Narhar Ambre
Rushab Narhar Ambre

Reputation: 9

Article helps you to install #elasticsearch on #raspberrypi. normally its difficult to install Elasticsearch on raspberry with its own jdk which is not support for armf platform. So in this article we run Elasticsearch with the help of no_jdk bundle of Elasticsearch and provide jdk(java Home ) of raspberry pi. if there is any difficulty be free to ask #raspberrypi #elastic #elasticsearch

Click here for article

Upvotes: -2

Hamza EL KAROUI
Hamza EL KAROUI

Reputation: 79

In our case at charik.org, we are running a cluster of RPI4 with Ubuntu server 19.10 which is the only OS fully supporting Arm64v8 architecture on Raspberry Pi.

The decision to use this OS was not easy, coz it consumes more memory than a lightweight raspbian, but the ease of use can fully explain our decision.

We build Elasticsearch v7.5.1 image for Arm64v8 architecture from ES package with no jdk embedded found here: elasticsearch-no-jdk.

To checkout our Docker Hub repo for the build image: charik/elasticsearch:latest

Upvotes: 1

module-art
module-art

Reputation: 11

On Raspbian-9 after a test to install elasticsearch-7 and purge it to install elasticsearch-6, in addition to what is said above, I had to define JAVA_HOME in /etc/default/elasticsearch :

# Elasticsearch Java path
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-armhf

The user was not the right one for two folders, to fix it :

sudo chown -R elasticsearch:elasticsearch /etc/elasticsearch
sudo chown -R elasticsearch:elasticsearch /var/lib/elasticsearch

Upvotes: 1

frankieandshadow
frankieandshadow

Reputation: 581

Unfortunately, unlike all previous releases, the deb package for ElasticSearch 7 is only packaged for Intel architectures. I believe the dependencies are the JVM and the machine learning module, which can be turned off, but it would have to be repackaged or installed by hand from the files in the deb package. (If I don't get round to doing it, I'm, sure someone else will eventually).

Unless you particularly need ES7 features, the easiest thing would be to install the last version 6, which will install on Raspbian. It's here: https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.0.deb

You will want to change the default memory used from 1G to 512M in /etc/elasticsearch/jvm.options and turn off machine learning in /etc/elasticsearch/elasticsearch.yml (xpack.ml.enabled: false).

While it will run with openjre, the default Java run time on Raspbian, it runs about 30 times slower than on an equivalent Intel. I've never got to the bottom of why, but it is fine if you install the Oracle JRE instead:

apt-get install oracle-java8-jdk

Note the Raspbian/Debian repo (as in apt-get install) is version 1 not v7 - ancient, avoid it.

In extensive use of ES6 (and its predecessors) on Raspberry Pi, I have not found anything to work differently from Intel, despite their statement that they don't support anything other than Intel.

However, RPi struggles to run the whole ELK (Elasticsearch, Logstatsh, Kibana) stack (I did try that): it really doesn't have enough memory. The RPi 4 with 4GB might do better, I haven't tried, or distributed across three separate Pis. I did get ELK 5 to run but it exhausted memory after a few day's use, and I couldn't get ELK 6 to run at all.

Upvotes: 3

Gandalf
Gandalf

Reputation: 1

ElasticSearch embed is own java binaries into the folder jdk.

You can define JAVA_HOME from your own system with :

JAVA_HOME=/usr ./bin/elasticsearch

Then you will be unsupported, but, can use elasticsearch on arm...

Upvotes: 0

Related Questions