如何使用docker-conpose 部署8.1.3版本的elasticsearch三节点集群和kabana,关闭https
时间: 2024-05-02 22:21:00 浏览: 152
docker-compose部署elasticsearch集群
以下是使用docker-compose部署8.1.3版本的elasticsearch三节点集群和kibana的示例docker-compose.yml文件,其中关闭了https:
```
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.1.3
container_name: elasticsearch
environment:
- node.name=node1
- cluster.name=my-cluster
- discovery.seed_hosts=elasticsearch2,elasticsearch3
- cluster.initial_master_nodes=node1,node2,node3
- ES_JAVA_OPTS=-Xms512m -Xmx512m
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9300:9300
networks:
- elastic
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:8.1.3
container_name: elasticsearch2
environment:
- node.name=node2
- cluster.name=my-cluster
- discovery.seed_hosts=elasticsearch,elasticsearch3
- cluster.initial_master_nodes=node1,node2,node3
- ES_JAVA_OPTS=-Xms512m -Xmx512m
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata2:/usr/share/elasticsearch/data
networks:
- elastic
elasticsearch3:
image: docker.elastic.co/elasticsearch/elasticsearch:8.1.3
container_name: elasticsearch3
environment:
- node.name=node3
- cluster.name=my-cluster
- discovery.seed_hosts=elasticsearch,elasticsearch2
- cluster.initial_master_nodes=node1,node2,node3
- ES_JAVA_OPTS=-Xms512m -Xmx512m
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata3:/usr/share/elasticsearch/data
networks:
- elastic
kibana:
image: docker.elastic.co/kibana/kibana:8.1.3
container_name: kibana
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
ports:
- 5601:5601
networks:
- elastic
volumes:
esdata1:
esdata2:
esdata3:
networks:
elastic:
```
在终端中使用以下命令启动docker-compose:
```
docker-compose up -d
```
这会启动一个三节点的elasticsearch集群和一个单独的kibana节点,可以使用http://localhost:5601访问kibana。如果需要关闭https,只需在kibana的环境变量中指定ELASTICSEARCH_HOSTS为http://elasticsearch:9200即可。
阅读全文