Elasticsearch搭建偽叢集
阿新 • • 發佈:2018-12-21
docker-compose.yml
version: '3'
services:
node1:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.2
container_name: node1
environment:
- node.name=es01
- cluster.name=es-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
nproc : 65535
memlock:
soft: -1
hard: -1
cap_add:
- ALL
privileged: true
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
volumes:
- ./node1/data:/usr/share/elasticsearch/data
ports :
- 9200:9200
- 9300:9300
node2:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.2
container_name: node2
environment:
- node.name=es02
- cluster.name=es-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.zen.ping.unicast.hosts=node1"
ulimits:
nproc: 65535
memlock:
soft: -1
hard: -1
cap_add:
- ALL
privileged: true
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
volumes:
- ./node2/data:/usr/share/elasticsearch/data
ports:
- 9201:9200
- 9301:9300
kibana:
image: docker.elastic.co/kibana/kibana:6.4.2
container_name: kibana
environment:
SERVER_NAME: localhost
ELASTICSEARCH_URL: http://node1:9200
ports:
- 5601:5601
ulimits:
nproc: 65535
memlock:
soft: -1
hard: -1
cap_add:
- ALL
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s