有两种方法可以在docker swarm中部署弹性集群
1)一种带有副本的docker服务,如此处http://derpturkey.com/elasticsearch-cluster-with-docker-engine-swarm-mode/所述,它具有dns循环轮询
version: '3.5'
services:
elastic-2:
image:elasticsearch:7.4.2
deploy:
replicas: 3
...
2)此处https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
所述的独立服务version: '3.5'
services:
elastic-1:
image: elasticsearch:7.4.2
environment:
- node.name=elastic-1
- discovery.seed_hosts=elastic-1,elastic-3,elastic-2
- cluster.initial_master_nodes=elastic-1
- cluster.name=docker-cluster
- "ES_JAVA_OPTS=-Xms2048m -Xmx2048m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata:/usr/share/elasticsearch/data
deploy:
placement:
constraints:
- node.hostname==barn-1
resources:
limits:
memory: 8000M
sysctls:
- vm.max_map_count=262144
elastic-2:
...
elastic-3:
...
我应将其中哪些用于elasticsearch:7.X?他们每个人都有哪些利弊?