如何部署ES(Elasticsearch)群集?
我使用Docker Swarm + Compose来部署我的系统,我尝试通过.yml部署ES集群:
version: '3.3'
services:
elasticsearch:
image: elasticsearch:alpine
ports:
- '9200:9200'
- '9300:9300'
command: [ elasticsearch, -E, network.host=0.0.0.0, -E, discovery.zen.ping.unicast.hosts=elasticsearch, -E, discovery.zen.minimum_master_nodes=1, -E, cluster.name=mycluster ]
networks:
- esnet1
environment:
ES_JAVA_OPTS: "-Xmx512m -Xms512m"
deploy:
mode: replicated
replicas: 2
#endpoint_mode: dnsrr
resources:
limits:
cpus: '2'
memory: 1024M
reservations:
cpus: '0.50'
memory: 512M
networks:
esnet1:
呼叫请求<ip>:9200/_cat/nodes?v
我看到单个实例。问题https://github.com/elastic/elasticsearch-docker/issues/91说它是Docker中的错误,它将被修复。没关系,但没有集群的ES不是ES!
在Internet上,我看到那些人将不同的服务部署为主服务器和奴服服务器,但它是笨拙的解决方案,因为ES本身决定了主人是谁,谁没有,是否胜任。
有趣的问题:如何部署ES群集?
答案 0 :(得分:0)
回答这个问题:https://github.com/elastic/elasticsearch-docker/issues/91#issuecomment-328671018
使用docker 17.09.0-ce-rc1或更高版本
例如: https://github.com/elastic/elasticsearch-docker/issues/91#issuecomment-330032899