docker-compose.yml
version: '3.6'
services:
es_1:
# 镜像名称
image: elasticsearch:8.6.0
# 容器名称
container_name: es_1
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
# 文件映射到主机
volumes:
- /data/es/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /data/es/plugins:/usr/share/elasticsearch/plugins
- /data/es/data/es1-data:/usr/share/elasticsearch/data
# 赋予权限
privileged: true
#端口映射
ports:
- 9200:9200
- 9300:9300
# 指定网段
networks:
defalut:
ipv4_address: 173.199.8.2 #设置ip地址
es_2:
# 镜像名称
image: elasticsearch:8.6.0
# 容器名称
container_name: es_2
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
# 文件映射到主机
volumes:
- /data/es/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /data/es/plugins:/usr/share/elasticsearch/plugins
- /data/es/data/es2-data:/usr/share/elasticsearch/data
# 赋予权限
privileged: true
#端口映射
ports:
- 9201:9200
- 9301:9300
# 指定网段
networks:
defalut:
ipv4_address: 173.199.8.3 #设置ip地址
es_3:
# 镜像名称
image: elasticsearch:8.6.0
# 容器名称
container_name: es_3
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
# 文件映射到主机
volumes:
- /data/es/config/es3.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- /data/es/plugins:/usr/share/elasticsearch/plugins
- /data/es/data/es3-data:/usr/share/elasticsearch/data
# 赋予权限
privileged: true
#端口映射
ports:
- 9202:9200
- 9302:9300
# 指定网段
networks:
defalut:
ipv4_address: 173.199.8.4 #设置ip地址
kibana:
# 镜像名称
image: kibana:8.6.0
# 容器名称
container_name: kibana
ports:
- 5601:5601
volumes:
- /data/es/config/kibana.yml:/usr/share/kibana/config/kibana.yml
depends_on:
- elasticsearch-cluster
networks:
defalut:
ipv4_address: 173.199.8.5 #设置ip地址
networks:
defalut:
driver: bridge
ipam:
config:
- subnet: "173.199.8.0/24"
es1.yml
cluster.name: elasticsearch-cluster
node.name: es-node1
network.host: 0.0.0.0
network.publish_host: 173.199.8.2
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.initial_master_nodes: es-node1
discovery.seed_hosts: ["173.199.8.2:9300", "173.199.8.3:9300", "173.199.8.4:9300"]
transport.profiles.default.port: 9300
xpack.security.enabled: false
es2.yml
cluster.name: elasticsearch-cluster
node.name: es-node2
network.host: 0.0.0.0
network.publish_host: 173.199.8.3
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.initial_master_nodes: es-node1
discovery.seed_hosts: ["173.199.8.2:9300", "173.199.8.3:9300", "173.199.8.4:9300"]
transport.profiles.default.port: 9300
xpack.security.enabled: false
es3.yml
cluster.name: elasticsearch-cluster
node.name: es-node3
network.host: 0.0.0.0
network.publish_host: 173.199.8.4
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.initial_master_nodes: es-node1
discovery.seed_hosts: ["173.199.8.2:9300", "173.199.8.3:9300", "173.199.8.4:9300"]
transport.profiles.default.port: 9300
xpack.security.enabled: false
kibana.yml
elasticsearch.hosts: ["http://es_1:9200","http://es_2:9200","http://es_3:9200"]
server.host: 0.0.0.0
server.port: 5601
i18n.locale: "zh-CN"
参考资料:
docker-compose 搭建elasticsearch 集群及kibana - 简书
更新_Docker安装ElasticSearch8.6.0文章来源:https://www.toymoban.com/news/detail-542386.html
Docker安装ElasticSearch8.6.0文章来源地址https://www.toymoban.com/news/detail-542386.html
到了这里,关于docker-compose搭建elasticsearch 8.6.0集群 —— 筑梦之路的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!