之前在服务器内存大小不够的时候有使用过单节点的测试,但是单节点并不能体会到 ES 的精髓了,因为 Elastic 本身就是弹性、伸缩的意思
如今终于开启了三个节点的集群模式:
内存使用是单个节点 3G,加起来一共用了大概 10G。
新的 Elastic 服务地址:https://elastic.dev.tabll.cn
Kibana 服务(开启了鉴权模块):https://kibana.dev.tabll.cn
原先单节点的数据可以直接复制到新主节点的 volume 里面直接使用,数据(包括用户名密码、证书等)都会保存下来
部署的时候遇到了很多的坑啊,不过解决方法都能够搜索到,这里就不再赘述了,附上我的 DockerCompose 文件的配置,可能会有所帮助:
version: '2.2'
services:
es01:
image: ccr.ccs.tencentyun.com/tabll/elasticsearch:dev
container_name: es01
environment:
- network.host=0.0.0.0
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es02,es03
- cluster.initial_master_nodes=es01
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms2048m -Xmx2048m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- elasticsearch:/usr/share/elasticsearch/data
- config01:/usr/share/elasticsearch/config
ports:
- 9200:9200
networks:
- elastic
es02:
image: ccr.ccs.tencentyun.com/tabll/elasticsearch:dev
container_name: es02
environment:
- network.host=0.0.0.0
- node.name=es02
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01,es03
- cluster.initial_master_nodes=es01
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms2048m -Xmx2048m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data02:/usr/share/elasticsearch/data
- config02:/usr/share/elasticsearch/config
networks:
- elastic
es03:
image: ccr.ccs.tencentyun.com/tabll/elasticsearch:dev
container_name: es03
environment:
- network.host=0.0.0.0
- node.name=es03
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01,es02
- cluster.initial_master_nodes=es01
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms2048m -Xmx2048m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data03:/usr/share/elasticsearch/data
- config03:/usr/share/elasticsearch/config
networks:
- elastic
volumes:
elasticsearch:
driver: local
data02:
driver: local
data03:
driver: local
config01:
driver: local
config02:
driver: local
config03:
driver: local
networks:
elastic:
driver: bridge
ccr.ccs.tencentyun.com/tabll/elasticsearch 是我自己在官方镜像的基础之上制作的,加上了中文分词模块和白金版的长期体验功能,就暂不提供给大家学习和参考了