Latest version of the Elastic stack with Docker and Docker Compose.
Note: An other branche but depreciated is available with cerebro (listen on port 9000)
- Install Docker version 17.05+
- Install Docker Compose version 1.6.0+
- Clone this repository
Based on the official Docker images from Elastic:
By default, the stack exposes the following ports:
- 5000: Logstash TCP input
- 9200: Elasticsearch HTTP
- 9300: Elasticsearch TCP transport
- 5601: Kibana
NOTE: Configuration is not dynamically reloaded, you will need to restart the stack after any change in the configuration of a component.
The Kibana default configuration is stored in kibana/config/kibana.yml
.
It is also possible to map the entire config
directory instead of a single file.
The Logstash configuration is stored in logstash/config/logstash.yml
.
It is also possible to map the entire config
directory instead of a single file, however you must be aware that
Logstash will be expecting a
log4j2.properties
file for its own
logging.
The Elasticsearch configuration is stored in elasticsearch/config/elasticsearch.yml
.
You can also specify the options you want to override directly via environment variables:
elasticsearch:
environment:
network.host: "_non_loopback_"
cluster.name: "my-cluster"
The data stored in Elasticsearch will be persisted after container reboot but not after container removal.
In order to persist Elasticsearch data even after removing the Elasticsearch container, you'll have to mount a volume on
your Docker host. Update the elasticsearch
service declaration to:
elasticsearch:
volumes:
- /path/to/storage:/usr/share/elasticsearch/data
This will store Elasticsearch data inside /path/to/storage
.
NOTE:
Beware of the unprivileged elasticsearch
user is used within the Elasticsearch image, therefore the mounted data directory must be owned by the uid 1000
.
By default, both Elasticsearch and Logstash start with 1/4 of the total host memory allocated to the JVM Heap Size.
The startup scripts for Elasticsearch and Logstash can append extra JVM options from the value of an environment variable, allowing the user to adjust the amount of memory that can be used by each component:
Service | Environment variable |
---|---|
Elasticsearch | ES_JAVA_OPTS |
Logstash | LS_JAVA_OPTS |
To accomodate environments where memory is scarce (Docker for Mac has only 2 GB available by default), the Heap Size
allocation is capped by default to 256MB per service in the docker-compose.yml
file. If you want to override the
default JVM configuration, edit the matching environment variable(s) in the docker-compose.yml
file.
For example, to increase the maximum JVM Heap Size for Logstash:
logstash:
environment:
LS_JAVA_OPTS: "-Xmx1g -Xms1g"
To use a different Elastic Stack version than the one currently available in the repository, simply change the version
number inside the .env
file, and rebuild the stack with:
$ docker-compose build
$ docker-compose up
NOTE: Always pay attention to the upgrade instructions for each individual component before performing a stack upgrade.