Deploying Elasticsearch on a Raspberry Pi

The Raspberry Pi is capable of running the NoSQL database Elasticsearch.

Either use Arch Linux ARM or the Raspbian Lite (Stretch) image and add the Elasticsearch apt repository. The packages are cross platform, but there are no official arm packages in the debian repository, so you need to force arch=amd64:

deb [arch=amd64] http://packages.elasticsearch.org/elasticsearch/5.x/debian stable main
  • Mount a btrfs formatted USB stick to /var/lib/elasticsearch using nodatacow,noatime,nobarrier. COW should always be disabled for directories with database files.
  • Install elasticsearch kibana and NodeJS (on ArchLinux with Kibana 5.5, you need nodejs-lts-boron).
  • Set the Elastic jvm minimum/maximum heap size to 12 of your Pi’s RAM. The rest will be used by Elastic’s Lucene backend.
  • Disable system call filter checks on startup with bootstrap.system_call_filter: false because the Raspberry Pi does not support JNI, which Elastic tries to import in order to run the checks.
  • Increase ping timeouts. The Raspberry Pi needs several minutes to start Elasticsearch and will timeout often. discovery.zen.ping_timeout: 60
  • Set up clustering: specify a cluster name, add a few discovery.zen.ping.unicast.hosts and most importantly increase discovery.zen.minimum_master_nodes to the minimum number of nodes / 2 + 1. The initial discovery will take a long time with timeouts from the Raspberry Pis in the cluster and increasing the minimum number of nodes will prevent the “split brain” where multiple Raspberry Pis elect themselves at masters.

Having tested an Elasticsearch cluster with a 20G index across 3 Raspberry Pi nodes and my laptop, I cannot recommend it. Performance was awful, syncing data took hours, and removing the Pis from the cluster again was a pain.