Skip to content

Instantly share code, notes, and snippets.

@yogeek
Created January 16, 2018 23:24
Show Gist options
  • Save yogeek/087a809c94799429f59df9c5a94e1870 to your computer and use it in GitHub Desktop.
Save yogeek/087a809c94799429f59df9c5a94e1870 to your computer and use it in GitHub Desktop.
ElasticSearch
version: "3.4"
services:
elasticsearch:
# Remember to "sysctl -w vm.max_map_count=262144" on swarm nodes
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.5
environment:
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: elasticsearch
discovery.zen.minimum_master_nodes: 1
cluster.name: elasticsearch
# bootstrap.memory_lock=true
ES_JAVA_OPTS: "-Xms512m -Xmx512m -XX:-AssumeMP"
xpack.security.enabled: "false"
xpack.monitoring.enabled: "false"
xpack.ml.enabled: "false"
xpack.graph.enabled: "false"
xpack.watcher.enabled: "false"
http.cors.enabled: "true"
http.cors.allow-origin: "*"
# max_local_storage_nodes : 1 data path by node is recommended
# node.max_local_storage_nodes: 1
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
networks:
- elk
# Ports cannnot be published with DNSRR
# ports:
# - "9200:9200"
deploy:
# DNS Round Robin is need to allow ES to discover its nodes
# But Swarm does not allow to use DNSRR and to publish ports
# (if ES must be published outside of the Swarm cluster, use a reverse proxy like NGINX)
endpoint_mode: dnsrr
resources:
limits:
memory: 1G
update_config:
parallelism: 1
delay: 1m30s
restart_policy:
condition: on-failure
#
# Comment for now because healthcheck cause an error when ElasticSearch launch
# healthcheck:
# test: "curl --silent --fail localhost:9200/_cluster/health?wait_for_status=yellow&timeout=50s || exit 1"
# interval: 1m30s
# timeout: 50s
# retries: 5
# Deply Stack
docker stack deploy -c docker-stack.yml elk
# Scale
docker service scale elk_elasticsearc=3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment