ElasticSearch instance fails at loading (wrong)

ElasticSearch (ES from now onwards) will fail to initialize since the parameters for its environment are not correct or absent. These are:

* `cluster.name`: Name of the cluster itself
* `bootstrap.memory_lock`: Needed for ES to [lock the JVM into swap instead of memory](https://www.elastic.co/guide/en/elasticsearch/reference/master/_memory_lock_check.html).
* `"ES_JAVA_OPTS=-Xms256m -Xmx256m"`: [Initial and maximum HEAP size for JVM](https://www.elastic.co/guide/en/elasticsearch/reference/current/_heap_size_check.html). Since it's locked to disk, should be the same. Half the defaults (512m) for development.
* `ulimits: memlock: soft (-1), hard (-1)`: [ES needs to have unlimited access to memory](https://www.elastic.co/guide/en/elasticsearch/reference/current/max-size-virtual-memory-check.html), otherwise it will feel sluggish.  
* `mem_limit: 512m`: Hard limit the memory available for the container.

This can, and should, be changed using `.env` file variables, but it seems that this should suffice for basic ES development.
This commit is contained in:
ItaloBC 2017-06-14 14:19:47 -04:00 committed by GitHub
parent c35445b066
commit bbbd247653

View File

@ -473,6 +473,15 @@ services:
volumes: volumes:
- elasticsearch-data:/usr/share/elasticsearch/data - elasticsearch-data:/usr/share/elasticsearch/data
- elasticsearch-plugins:/usr/share/elasticsearch/plugins - elasticsearch-plugins:/usr/share/elasticsearch/plugins
environment:
- cluster.name=laradock-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 512m
ports: ports:
- "${ELASTICSEARCH_HOST_HTTP_PORT}:9200" - "${ELASTICSEARCH_HOST_HTTP_PORT}:9200"
- "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300" - "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300"