Skip to content

An elasticsearch cluster in docker for educational and development purposes. TLS enabled cluster equivalent here: https://github.com/jeroenhendricksen/elasticsearch-docker-cluster-tls

Notifications You must be signed in to change notification settings

jeroenhe/elasticsearch-docker-cluster

Repository files navigation

Elasticsearch cluster in docker

This project provides you with an elasticsearch cluster consisting of three elasticsearch instances, using the basic license. I've created it during and after the Elastic Engineer training to help me with a ready-to-go environment where I can play with the training labs.

Disclaimer: this setup is not meant for production usage!

Prerequisites

  • A machine with enough RAM (at least 8 gb allocated for the docker environment)
  • Docker. (Docker Desktop will suffice for Mac or Windows, but another provider like Rancher Desktop should also work).

Elasticsearch indices

Some example indices are created at startup:

test-index

Docker container es-writer writes data continuously to index test-index and reads it using container es-reader, all using python scripts and the official low-level elasticsearch python client library. View the data.

blogs

Example taken from the Elastic Engineer I training containing an excerpt from their online blogs. The index is created (once) from a csv file using the logstash-ingest docker container. View the data. This is a Static Dataset.

logs_server*

Example taken from the Elastic Engineer I training as well, containing an excerpt from websserver access logs for the elastic blogs website. View the data. This is a Time Series Dataset. It can take a while to import this entirely.

Get it up and running

Make sure you provide docker with enough memory (the default 2gb of memory is not enough, consult your Docker Desktop configuration to change this), before you run it with:

docker compose up -d

OR

./run.sh


# Stop the services
./down.sh

# Stop the services and clean the volumes. This is useful for starting with a clean slate.
./clean.sh

Confirm that elasticsearch is healthy (after a little while) by visiting one of the following links from your browser or a tool like curl or httpie:

Elastic search nodes:

Other services:

(Optional) Setup security features for Elasticsearch

By default, the Elasticsearch security features are disabled when you have a basic or trial license. To enable security features, use the xpack.security.enabled setting..

Starting with Elastic Stack 6.8 and 7.1, security features like TLS encrypted communication, role-based access control (RBAC), and more are available for free within the default distribution. In this blog post, we’re going to cover how to get started with using these features to secure your Elasticsearch clusters.

(source)

Snapshots

A folder has been bind-mounted to all elasticsearch nodes already with the purpose of sharing snapshots with the docker host. This folder is relative from this directory: ./shared_folder. When registering a (fs-type) snapshot repository inside elasticsearch, you should make it point to /shared_folder from inside the container.