도커로 elastic search 설치하기
2017-07-25일단 docker-compose.yml 로 다음을 지정
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.0
container_name: elasticsearch1
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1g
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- esnet
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:5.5.0
container_name: elasticsearch2
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.zen.ping.unicast.hosts=elasticsearch1"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1g
volumes:
- esdata2:/usr/share/elasticsearch/data
networks:
- esnet
volumes:
esdata1:
driver: local
esdata2:
driver: local
networks:
esnet:
그 다음 docker-compose 로 띄운다.
docker-compose up
이제 제대로 떴는지 확인을 할 텐데, 기본 비번은 changeme, user id는 elastic 이고 http basic authentication으로 접속한다.
$ curl -u elastic:changeme http://127.0.0.1:9200/_cat/health
결과 1500017692 07:34:52 docker-cluster green 2 2 10 5 0 0 0 0 - 100.0%
green 이고 100%면 된다. 이러면 일단 떴다.