docker-compose.yml 文件
version: '2.2'
services:
es01:
image: elasticsearch:7.6.0
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es02,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/es/data01/data:/usr/share/elasticsearch/data
- /opt/es/data01/logs:/usr/share/elasticsearch/logs
ports:
- 9200:9200
networks:
- elastic
es02:
image: elasticsearch:7.6.0
container_name: es02
environment:
- node.name=es02
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01,es03
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/es/data02/data:/usr/share/elasticsearch/data
- /opt/es/data02/logs:/usr/share/elasticsearch/logs
networks:
- elastic
es03:
image: elasticsearch:7.6.0
container_name: es03
environment:
- node.name=es03
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01,es02
- cluster.initial_master_nodes=es01,es02,es03
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /opt/es/data03/data:/usr/share/elasticsearch/data
- /opt/es/data03/logs:/usr/share/elasticsearch/logs
networks:
- elastic
kibana:
image: kibana:7.6.0
container_name: kibana
environment:
- I18N_LOCALE=zh-CN
ports:
- "5601:5601"
links:
- es01:elasticsearch
depends_on:
- es01
- es02
- es03
networks:
- elastic
cerebro:
image: lmenezes/cerebro:0.8.3
container_name: cerebro
ports:
- "9000:9000"
command:
- -Dhosts.0.host=http://elasticsearch:9200
networks:
- elastic
volumes:
data01:
driver: local
data02:
driver: local
data03:
driver: local
networks:
elastic:
driver: bridge
运行 docker-compose up
遇到权限问题
chmod -R 777 data01/* data02/*