docker compose一键部署ElasticSearch7.71.25实战
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.编写docker-compose文件
version: '3.3'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.25
container_name: es01
environment:
- node.name=es01
- cluster.name=yinzhengjie-linux-es-cluster
- discovery.seed_hosts=es02,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
# 配置资源限制
ulimits:
# 配置内存锁定
memlock:
# 软限制,-1代表不限制
soft: -1
# 硬限制,-1代表不限制
hard: -1
# 参考文档: https://docs.docker.com/reference/compose-file/services/#sysctls
#sysctls:
# vm.max_map_count: 262144
volumes:
- data01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.25
container_name: es02
environment:
- node.name=es02
- cluster.name=yinzhengjie-linux-es-cluster
- discovery.seed_hosts=es01,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
#sysctls:
# vm.max_map_count: 262144
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data02:/usr/share/elasticsearch/data
networks:
- elastic
es03:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.25
container_name: es03
#sysctls:
# vm.max_map_count: 262144
environment:
- node.name=es03
- cluster.name=yinzhengjie-linux-es-cluster
- discovery.seed_hosts=es01,es02
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms256m -Xmx256m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data03:/usr/share/elasticsearch/data
networks:
- elastic
volumes:
data01:
driver: local
data02:
driver: local
data03:
driver: local
networks:
elastic:
driver: bridge
二.启动实例
docker-compose up -d
当你的才华还撑不起你的野心的时候,你就应该静下心来学习。当你的能力还驾驭不了你的目标的时候,你就应该沉下心来历练。问问自己,想要怎样的人生。
欢迎交流学习技术交流,个人微信: "JasonYin2020"(添加时请备注来源及意图备注)
作者: 尹正杰, 博客: https://www.cnblogs.com/yinzhengjie/p/18516893