Forked from jakubhajek/Elasticsearch 7.x on Docker Swarm
Created
May 5, 2021 07:29
-
-
Save naviat/75bf1704dc81c52fe03a3065a21f48e8 to your computer and use it in GitHub Desktop.
Revisions
-
jakubhajek created this gist
Nov 19, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,216 @@ # Maintainer: Jakub Hajek, [email protected] # # docker stack deploy -c stack-elastic.yml elastic # # The stack creates Elasticsearch cluster consiting of # - 3 dedicated master nodes in order to keep quorum # - 4 dedicated data nodes to manage CRUD, # # Docker compose file to easily deploy Elasticsearch cluster 7.x on Docker Swarm cluster. # Make sure to tune your VM to run Elasticsearch cluster by executing on each server: # sudo sysctl -w vm.max_map_count=262144 # add --default-ulimit memlock=-1 to Dockerd # You can manage that by executing this command on each server consiting Swarm cluter: # # sudo "sed -i '/ExecStart=\/usr\/bin\/dockerd/ s/$/\ --default-ulimit memlock=-1/' /etc/systemd/system/docker.service.d/10-machine.conf" version: "3.7" x-default-logs: &default-opts logging: options: max-size: "1m" x-master-opts: &master ES_JAVA_OPTS: "-Xmx2g -Xms2g" discovery.seed_resolver.timeout: 60s discovery.seed_hosts: master1,master2,master3 cluster.initial_master_nodes: master1,master2,master3 cluster.name: "es-cluster" network.host: 0.0.0.0 node.master: "true" node.data: "false" node.ingest: "false" x-data-opts: &data ES_JAVA_OPTS: "-Xmx2g -Xms2g" discovery.seed_resolver.timeout: 60s discovery.seed_hosts: master1,master2,master3 cluster.initial_master_nodes: master1,master2,master3 cluster.name: "es-cluster" network.host: 0.0.0.0 node.master: "false" node.data: "true" node.ingest: "false" services: master1: image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2 environment: <<: *master node.name: "master1" networks: esnet: aliases: - master1 volumes: - esmaster1:/usr/share/elasticsearch/data deploy: placement: constraints: [node.labels.master1 == true] endpoint_mode: dnsrr mode: "replicated" replicas: 1 resources: limits: memory: 4G master2: image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2 environment: <<: *master node.name: "master2" networks: esnet: aliases: - master2 volumes: - esmaster2:/usr/share/elasticsearch/data deploy: placement: constraints: [node.labels.master2 == true] endpoint_mode: dnsrr mode: "replicated" replicas: 1 resources: limits: memory: 4G master3: image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2 environment: <<: *master node.name: "master3" networks: esnet: aliases: - master3 volumes: - esmaster3:/usr/share/elasticsearch/data deploy: placement: constraints: [node.labels.master3 == true] mode: "replicated" replicas: 1 resources: limits: memory: 4G data1: image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2 environment: <<: *data node.name: "data1" healthcheck: test: curl -fs http://localhost:9200/_cat/health || exit 1 interval: 30s timeout: 5s retries: 3 start_period: 45s networks: esnet: aliases: - data1 volumes: - esdata1:/usr/share/elasticsearch/data deploy: placement: constraints: [node.labels.data1 == true] endpoint_mode: dnsrr mode: "replicated" replicas: 1 resources: limits: memory: 4G data2: image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2 environment: <<: *data node.name: "data2" healthcheck: test: curl -fs http://localhost:9200/_cat/health || exit 1 interval: 30s timeout: 5s retries: 3 start_period: 45s networks: esnet: aliases: - data2 volumes: - esdata2:/usr/share/elasticsearch/data deploy: placement: constraints: [node.labels.data2 == true] endpoint_mode: dnsrr mode: "replicated" replicas: 1 resources: limits: memory: 4G data3: image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2 environment: <<: *data node.name: "data3" networks: esnet: aliases: - data3 volumes: - esdata3:/usr/share/elasticsearch/data deploy: placement: constraints: [node.labels.data3 == true] endpoint_mode: dnsrr mode: "replicated" replicas: 1 resources: limits: memory: 4G data4: image: docker.elastic.co/elasticsearch/elasticsearch:7.4.2 environment: <<: *data node.name: "data4" networks: esnet: aliases: - data4 volumes: - esdata4:/usr/share/elasticsearch/data deploy: placement: constraints: [node.labels.data4 == true] endpoint_mode: dnsrr mode: "replicated" replicas: 1 resources: limits: memory: 4G networks: esnet: driver: overlay attachable: true name: esnet volumes: esdata1: esdata2: esdata3: esdata4: esmaster1: esmaster2: esmaster3: